<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.labrps.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LabRPS</id>
	<title>LabRPS Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.labrps.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LabRPS"/>
	<link rel="alternate" type="text/html" href="https://wiki.labrps.com/Special:Contributions/LabRPS"/>
	<updated>2026-04-21T16:09:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Std_DependencyGraph&amp;diff=2694</id>
		<title>Std DependencyGraph</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Std_DependencyGraph&amp;diff=2694"/>
		<updated>2025-03-01T21:09:31Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: Created page with &amp;quot;{{TOCright}}  == Description ==  The Dependency graph view displays the dependencies between objects in the active document in a graph. As opposed to the Tree view, objects are listed in reverse chronological order, with the first created object at the bottom. It can be useful in analyzing a LabRPS document and locating forks in a tree. The dependency graph is for now purely a visualization tool, therefore it cannot be edited. It a...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The [[Dependency graph view|Dependency graph view]] displays the dependencies between objects in the active document in a graph. As opposed to the [[Tree_view|Tree view]], objects are listed in reverse chronological order, with the first created object at the bottom. It can be useful in analyzing a LabRPS document and locating forks in a tree. The dependency graph is for now purely a visualization tool, therefore it cannot be edited. It automatically updates if changes are made to the document. The [[Dependency graph view|Dependency graph view]] is a component of the LabRPS [[interface]]. By default it shows nothing.&lt;br /&gt;
&lt;br /&gt;
[[Image:DependencyGraphView_example.png|800px]]&lt;br /&gt;
&lt;br /&gt;
{{Caption|Example of a dependency graph with simulation of wind velocity having a mean wind profile and a wind spectrum.}}&lt;br /&gt;
&lt;br /&gt;
==Installation== &lt;br /&gt;
&lt;br /&gt;
To have the graph displayed in the dependency graph view, a third-party software named [https://graphviz.org/ Graphviz] needs to be installed. If you do not have it pre-installed or it is installed in an unconventional location, LabRPS will display the following dialog:&lt;br /&gt;
&lt;br /&gt;
[[File:LabRPS-0.1-missing-Graphviz-error-dialogue.png]]&lt;br /&gt;
&lt;br /&gt;
===Windows=== &lt;br /&gt;
&lt;br /&gt;
Download the &#039;&#039;&#039;graphviz-2.xx&#039;&#039;&#039; installer from the [https://graphviz.org/download/#windows Graphviz Download page] and launch it to install it. Some older versions seem to have issues displaying the graph; version 2.38 and newer are known to be reliable. You can find all graphviz releases on [https://gitlab.com/graphviz/graphviz/-/releases Gitlab].&lt;br /&gt;
&lt;br /&gt;
===macOS=== &lt;br /&gt;
&lt;br /&gt;
You can install Graphviz using [https://brew.sh/ Homebrew] if you have macOS Big Sur (11) (or higher). While installing Homebrew, don&#039;t get nervous, if macOS asks you to install updates, e.g. for the Xcode commandline tools. These updates are performed later by the installation process.&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
brew install graphviz&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This installs the Graphviz binaries under {{FileName|/usr/local/bin}} for macOS on Intel, or {{FileName|/opt/homebrew}} for macOS on Apple Silicon/ARM. LabRPS should automatically find these locations. If the Graphviz program is not found you will be asked to specify a path. Unfortunately we can&#039;t navigate directly to the program in the file dialog. There are two options: You can use the key combination Cmd+Shift+. to show hidden items. Or you can use the key combination Cmd+Shift+G to get an input field for the path. Enter one of these paths in the [https://en.wikipedia.org/wiki/Terminal_(macOS) Terminal]:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
/usr/local/bin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
or:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
/opt/homebrew/bin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
and confirm the input field and the file selection dialog.&lt;br /&gt;
&lt;br /&gt;
In case the Graphviz binaries are installed in a non-standard location try to find the program with the command:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
type dot&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It will output something like: &lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
dot is /usr/local/bin/dot&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
And you can tell LabRPS to look in that directory.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have macOS Big Sur (11) (or higher) Homebrew might not work, but you can use [https://www.macports.org/index.php MacPorts] instead. Just download the [https://www.macports.org/install.php appropriate version for your OS]. Once the installation is complete, enter this command in the [https://en.wikipedia.org/wiki/Terminal_(macOS) Terminal]:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
sudo port install graphviz&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Enter your password and wait while the dependencies are downloaded and installed (it can take some time).&lt;br /&gt;
&lt;br /&gt;
The Graphviz binaries may be under {{FileName|/usr/local/bin}} or {{FileName|/opt/local/bin/dot}}. LabRPS may automatically find the Graphviz program with the file dialog that, if not enter this command:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
type dot&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It will output something like:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
dot is /opt/local/bin/dot&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
And you can tell LabRPS to look in that directory as explained before.&lt;br /&gt;
&lt;br /&gt;
It is also possible to make the opt directory visible with this command:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
defaults write com.apple.finder AppleShowAllFiles YES;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
then:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
killall Finder /System/Library/CoreServices/Finder.app;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Therefore you can tell LabRPS to follow this path. It has been successfully tested on macOS 10.13 (High Sierra).&lt;br /&gt;
&lt;br /&gt;
===Linux=== &lt;br /&gt;
&lt;br /&gt;
On most Linux distributions (Debian/Ubuntu, Fedora, OpenSUSE), you just need to install the Graphviz package from the repositories. However, similar to the macOS, in cases where the Graphviz binaries are installed in a non-standard location, try to find the program with the command:&lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
type dot&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It may output something like &lt;br /&gt;
&lt;br /&gt;
{{Code|lang=text|code=&lt;br /&gt;
dot is /usr/local/bin/dot&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
And therefore you can point LabRPS to look in that directory.&lt;br /&gt;
&lt;br /&gt;
==Save== &lt;br /&gt;
&lt;br /&gt;
You can save a dependency graph:&lt;br /&gt;
# Make sure the Dependency graph view is active.&lt;br /&gt;
# Select the {{MenuCommand|File → [[Std_Save|Save]]}} or {{MenuCommand|File → [[Std_SaveAs|Save As]]}} option from the menu.&lt;br /&gt;
# Enter a filename and select the file type (*.gv, *.png, *.bmp, *.gif, *.jpg, *.svg or *.pdf).&lt;br /&gt;
# Press the {{Button|Save}} button.&lt;br /&gt;
&lt;br /&gt;
==General principles== &lt;br /&gt;
&lt;br /&gt;
* The graph shows objects in reverse chronological order.&lt;br /&gt;
* The direction of arrows showing dependencies should always point down. An arrow pointing up indicates a cyclic dependency, an issue that needs to be resolved.&lt;br /&gt;
* Objects can have dependencies to multiple parents.&lt;br /&gt;
* A [[Std_Group|Group]] is displayed as a single element linked to its content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Std_Base_navi}}&lt;br /&gt;
{{Userdocnavi}}&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2693</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2693"/>
		<updated>2025-02-17T22:52:55Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the [[Std_AddonMgr|Addon Manager]] or the [https://github.com/LabRPS/LabRPS-plugins plugin repository]. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! No&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| [[Plugin_WindLab_DeodatisAndShinozuka1991|Masanobu Shinozuka and George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1115/1.3119501 Simulation of Stochastic Processes by Spectral Representation]&lt;br /&gt;
| 1991&lt;br /&gt;
| Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2692</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2692"/>
		<updated>2025-02-17T22:52:07Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the [[Std_AddonMgr|Addon Manager]] or the [https://github.com/LabRPS/LabRPS-plugins plugin repository]. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! No&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| [[Plugin_WindLab_DeodatisAndShinozuka1991|Masanobu Shinozuka and George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1115/1.3119501 Simulation of Stochastic Processes by Spectral Representation]&lt;br /&gt;
| 1991&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=MediaWiki:Sidebar&amp;diff=2691</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=MediaWiki:Sidebar&amp;diff=2691"/>
		<updated>2025-02-15T23:53:46Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;** About_LabRPS|Overview&lt;br /&gt;
** Feature_list|Features&lt;br /&gt;
** Screenshots|Screenshots&lt;br /&gt;
** Download|Download&lt;br /&gt;
** Frequently_asked_questions|FAQ&lt;br /&gt;
** http://labrps.com/boards/|Forum&lt;br /&gt;
** https://github.com/LabRPS/LabRPS/issues|Tracker&lt;br /&gt;
&lt;br /&gt;
* General usage&lt;br /&gt;
&lt;br /&gt;
** User_hub|User Hub&lt;br /&gt;
** Tutorials|Tutorials&lt;br /&gt;
** Installing|Installing&lt;br /&gt;
** Getting_started|Getting started&lt;br /&gt;
** Interface_Customization|Customizing LabRPS&lt;br /&gt;
** Category:Command_Reference|Commands list&lt;br /&gt;
** Simulation_Models|Simulation Models&lt;br /&gt;
&lt;br /&gt;
* Development&lt;br /&gt;
&lt;br /&gt;
** Developer_hub|Developer hub&lt;br /&gt;
** Help_LabRPS|How to contribute&lt;br /&gt;
** https://github.com/LabRPS/LabRPS|Git repository&lt;br /&gt;
** Compiling|Compiling&lt;br /&gt;
** Licence|License details&lt;br /&gt;
&lt;br /&gt;
* RPS Feature&lt;br /&gt;
** RPS_Feature_Group|RPS Features&lt;br /&gt;
** SeaLab_Feature|SeaLab Features&lt;br /&gt;
** SeismicLab_Feature|SeismicLab Features&lt;br /&gt;
** WindLab_Feature|WindLab Features&lt;br /&gt;
&lt;br /&gt;
* Plugins&lt;br /&gt;
** Plugin_Creation|Plugin Creation&lt;br /&gt;
** Plugins|Plugins list&lt;br /&gt;
** Plugin_WindLab|WindLab Plugin&lt;br /&gt;
** Plugin_SeismicLab|SeismicLab Plugin&lt;br /&gt;
** Plugin_SeaLab|SeadLab Plugin&lt;br /&gt;
** Plugin_UserLab|UserLab Plugin&lt;br /&gt;
&lt;br /&gt;
* Workbenches&lt;br /&gt;
&lt;br /&gt;
** Workbenches|Workbenches list&lt;br /&gt;
** WindLab_Workbench|WindLab&lt;br /&gt;
** SeismicLab_Workbench|SeismicLab&lt;br /&gt;
** SeaLab_Workbench|SeaLab&lt;br /&gt;
** Spreadsheet_Workbench|Spreadsheet&lt;br /&gt;
&lt;br /&gt;
* Alphaplot&lt;br /&gt;
&lt;br /&gt;
** Std_New_Table|Table&lt;br /&gt;
** Std_New_Matrix|Matrix&lt;br /&gt;
** Std_New_Graph|Graph&lt;br /&gt;
** Std_New_2DPlot|2D Plot&lt;br /&gt;
** Std_New_3DPlot|3D Plot&lt;br /&gt;
** Axis2d|Axis2d&lt;br /&gt;
** Fast_Fourier_Transform(FFT)|Fast Fourier Transform&lt;br /&gt;
** Correlation &amp;amp; Autocorrelation|Correlation&lt;br /&gt;
** Convolution &amp;amp; Deconvolution|Convolution&lt;br /&gt;
** Interpolation| Interpolation&lt;br /&gt;
** Fitting| Fitting&lt;br /&gt;
&lt;br /&gt;
* Python Scripting&lt;br /&gt;
&lt;br /&gt;
** Power_users_hub|Powerusers hub&lt;br /&gt;
** Introduction_to_Python|Discovering Python&lt;br /&gt;
** LabRPS_Scripting_Basics|Python in LabRPS&lt;br /&gt;
** Macros|Macros&lt;br /&gt;
** Scripted_objects|Parametric objects&lt;br /&gt;
** Scripting_and_macros|Code examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SEARCH&lt;br /&gt;
&lt;br /&gt;
* Help &amp;amp; Feedback&lt;br /&gt;
&lt;br /&gt;
** http://labrps.com/boards|Forum&lt;br /&gt;
** http://www.labrps.com/tracker/|Bugs tracker&lt;br /&gt;
** http://www.facebook.com/LabRPS|Facebook&lt;br /&gt;
** http://www.twitter.com/LabRPSNews|Twitter&lt;br /&gt;
&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* LANGUAGES&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2690</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2690"/>
		<updated>2025-02-15T22:48:32Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the [[Std_AddonMgr|Addon Manager]] or the [https://github.com/LabRPS/LabRPS-plugins plugin repository]. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! No&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2689</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2689"/>
		<updated>2025-02-15T22:28:17Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the Addon Manager or the plugin repository. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! No&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2688</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2688"/>
		<updated>2025-02-15T22:24:05Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the Addon Manager or the plugin repository. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;margin:auto&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! No&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2687</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2687"/>
		<updated>2025-02-15T22:22:57Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the Addon Manager or the plugin repository. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;margin:auto&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Number&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2686</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2686"/>
		<updated>2025-02-15T22:18:55Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the Addon Manager or the plugin repository. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;margin:auto&amp;quot; width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2685</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2685"/>
		<updated>2025-02-15T22:05:45Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the Addon Manager or the plugin repository. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Model&lt;br /&gt;
! Title&lt;br /&gt;
! Year&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| 1996&lt;br /&gt;
| Random Wind Velocity&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2684</id>
		<title>Simulation Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Simulation_Models&amp;diff=2684"/>
		<updated>2025-02-15T21:59:46Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: Created page with &amp;quot;{{Docnav |Tutorials |Plugins }}  {{TOCright}}  Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the Addon Manager or the plugin repository. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.  {| class=&amp;quot;wikitable sortable&amp;quot; |- ! Model ! Authors ! Phenomenon  |- | [...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
Here is a list of simulation models (methods) selected from various journal articles. The models presented here have been implemented in LabRPS and are available through either the Addon Manager or the plugin repository. Please note that these models may be official plugins from the LabRPS team or community-contributed plugins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Model&lt;br /&gt;
! Authors&lt;br /&gt;
! Phenomenon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Plugin_WindLab#George_Deodatis_Simulation_Method_1996|George Deodatis, 1996]]&lt;br /&gt;
| [https://doi.org/10.1061/(ASCE)0733-9399(1996)122:8(778) Simulation of Ergodic Multivariate Stochastic Processes]&lt;br /&gt;
| Beginner/intermediate&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Docnav&lt;br /&gt;
|[[Tutorials|Tutorials]]&lt;br /&gt;
|[[Plugins|Plugins]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Userdocnavi}}&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=MediaWiki:Sidebar&amp;diff=2683</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=MediaWiki:Sidebar&amp;diff=2683"/>
		<updated>2025-02-15T21:13:48Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;** About_LabRPS|Overview&lt;br /&gt;
** Feature_list|Features&lt;br /&gt;
** Screenshots|Screenshots&lt;br /&gt;
** Download|Download&lt;br /&gt;
** Frequently_asked_questions|FAQ&lt;br /&gt;
** http://labrps.com/boards/|Forum&lt;br /&gt;
** https://github.com/LabRPS/LabRPS/issues|Tracker&lt;br /&gt;
&lt;br /&gt;
* General usage&lt;br /&gt;
&lt;br /&gt;
** User_hub|User Hub&lt;br /&gt;
** Tutorials|Tutorials&lt;br /&gt;
** Installing|Installing&lt;br /&gt;
** Getting_started|Getting started&lt;br /&gt;
** Interface_Customization|Customizing LabRPS&lt;br /&gt;
** Category:Command_Reference|Commands list&lt;br /&gt;
** Simulation_Models|Simulation Models&lt;br /&gt;
&lt;br /&gt;
* Development&lt;br /&gt;
&lt;br /&gt;
** Developer_hub|Developer hub&lt;br /&gt;
** Help_LabRPS|How to contribute&lt;br /&gt;
** https://github.com/LabRPS/LabRPS|Git repository&lt;br /&gt;
** Compiling|Compiling&lt;br /&gt;
** Licence|License details&lt;br /&gt;
&lt;br /&gt;
* RPS Feature&lt;br /&gt;
** RPS_Feature_Group|RPS Features&lt;br /&gt;
** SeaLab_Feature|SeaLab Features&lt;br /&gt;
** SeismicLab_Feature|SeismicLab Features&lt;br /&gt;
** WindLab_Feature|WindLab Features&lt;br /&gt;
&lt;br /&gt;
* Plugins&lt;br /&gt;
** Plugin_Creation|Plugin Creation&lt;br /&gt;
** Plugins|Plugins list&lt;br /&gt;
** Plugin_WindLab|WindLab Plugin&lt;br /&gt;
** Plugin_SeismicLab|SeismicLab Plugin&lt;br /&gt;
** Plugin_SeaLab|SeadLab Plugin&lt;br /&gt;
** Plugin_UserLab|SeadLab Plugin&lt;br /&gt;
&lt;br /&gt;
* Workbenches&lt;br /&gt;
&lt;br /&gt;
** Workbenches|Workbenches list&lt;br /&gt;
** WindLab_Workbench|WindLab&lt;br /&gt;
** SeismicLab_Workbench|SeismicLab&lt;br /&gt;
** SeaLab_Workbench|SeaLab&lt;br /&gt;
** Spreadsheet_Workbench|Spreadsheet&lt;br /&gt;
&lt;br /&gt;
* Alphaplot&lt;br /&gt;
&lt;br /&gt;
** Std_New_Table|Table&lt;br /&gt;
** Std_New_Matrix|Matrix&lt;br /&gt;
** Std_New_Graph|Graph&lt;br /&gt;
** Std_New_2DPlot|2D Plot&lt;br /&gt;
** Std_New_3DPlot|3D Plot&lt;br /&gt;
** Axis2d|Axis2d&lt;br /&gt;
** Fast_Fourier_Transform(FFT)|Fast Fourier Transform&lt;br /&gt;
** Correlation &amp;amp; Autocorrelation|Correlation&lt;br /&gt;
** Convolution &amp;amp; Deconvolution|Convolution&lt;br /&gt;
** Interpolation| Interpolation&lt;br /&gt;
** Fitting| Fitting&lt;br /&gt;
&lt;br /&gt;
* Python Scripting&lt;br /&gt;
&lt;br /&gt;
** Power_users_hub|Powerusers hub&lt;br /&gt;
** Introduction_to_Python|Discovering Python&lt;br /&gt;
** LabRPS_Scripting_Basics|Python in LabRPS&lt;br /&gt;
** Macros|Macros&lt;br /&gt;
** Scripted_objects|Parametric objects&lt;br /&gt;
** Scripting_and_macros|Code examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SEARCH&lt;br /&gt;
&lt;br /&gt;
* Help &amp;amp; Feedback&lt;br /&gt;
&lt;br /&gt;
** http://labrps.com/boards|Forum&lt;br /&gt;
** http://www.labrps.com/tracker/|Bugs tracker&lt;br /&gt;
** http://www.facebook.com/LabRPS|Facebook&lt;br /&gt;
** http://www.twitter.com/LabRPSNews|Twitter&lt;br /&gt;
&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* LANGUAGES&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=MediaWiki:Sidebar&amp;diff=2682</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=MediaWiki:Sidebar&amp;diff=2682"/>
		<updated>2025-02-13T21:41:18Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;** About_LabRPS|Overview&lt;br /&gt;
** Feature_list|Features&lt;br /&gt;
** Screenshots|Screenshots&lt;br /&gt;
** Download|Download&lt;br /&gt;
** Frequently_asked_questions|FAQ&lt;br /&gt;
** http://labrps.com/boards/|Forum&lt;br /&gt;
** https://github.com/LabRPS/LabRPS/issues|Tracker&lt;br /&gt;
&lt;br /&gt;
* General usage&lt;br /&gt;
&lt;br /&gt;
** User_hub|User Hub&lt;br /&gt;
** Tutorials|Tutorials&lt;br /&gt;
** Installing|Installing&lt;br /&gt;
** Getting_started|Getting started&lt;br /&gt;
** Interface_Customization|Customizing LabRPS&lt;br /&gt;
** Category:Command_Reference|Commands list&lt;br /&gt;
&lt;br /&gt;
* Development&lt;br /&gt;
&lt;br /&gt;
** Developer_hub|Developer hub&lt;br /&gt;
** Help_LabRPS|How to contribute&lt;br /&gt;
** https://github.com/LabRPS/LabRPS|Git repository&lt;br /&gt;
** Compiling|Compiling&lt;br /&gt;
** Licence|License details&lt;br /&gt;
&lt;br /&gt;
* RPS Feature&lt;br /&gt;
** RPS_Feature_Group|RPS Features&lt;br /&gt;
** SeaLab_Feature|SeaLab Features&lt;br /&gt;
** SeismicLab_Feature|SeismicLab Features&lt;br /&gt;
** WindLab_Feature|WindLab Features&lt;br /&gt;
&lt;br /&gt;
* Plugins&lt;br /&gt;
** Plugin_Creation|Plugin Creation&lt;br /&gt;
** Plugins|Plugins list&lt;br /&gt;
** Plugin_WindLab|WindLab Plugin&lt;br /&gt;
** Plugin_SeismicLab|SeismicLab Plugin&lt;br /&gt;
** Plugin_SeaLab|SeadLab Plugin&lt;br /&gt;
** Plugin_UserLab|SeadLab Plugin&lt;br /&gt;
&lt;br /&gt;
* Workbenches&lt;br /&gt;
&lt;br /&gt;
** Workbenches|Workbenches list&lt;br /&gt;
** WindLab_Workbench|WindLab&lt;br /&gt;
** SeismicLab_Workbench|SeismicLab&lt;br /&gt;
** SeaLab_Workbench|SeaLab&lt;br /&gt;
** Spreadsheet_Workbench|Spreadsheet&lt;br /&gt;
&lt;br /&gt;
* Alphaplot&lt;br /&gt;
&lt;br /&gt;
** Std_New_Table|Table&lt;br /&gt;
** Std_New_Matrix|Matrix&lt;br /&gt;
** Std_New_Graph|Graph&lt;br /&gt;
** Std_New_2DPlot|2D Plot&lt;br /&gt;
** Std_New_3DPlot|3D Plot&lt;br /&gt;
** Axis2d|Axis2d&lt;br /&gt;
** Fast_Fourier_Transform(FFT)|Fast Fourier Transform&lt;br /&gt;
** Correlation &amp;amp; Autocorrelation|Correlation&lt;br /&gt;
** Convolution &amp;amp; Deconvolution|Convolution&lt;br /&gt;
** Interpolation| Interpolation&lt;br /&gt;
** Fitting| Fitting&lt;br /&gt;
&lt;br /&gt;
* Python Scripting&lt;br /&gt;
&lt;br /&gt;
** Power_users_hub|Powerusers hub&lt;br /&gt;
** Introduction_to_Python|Discovering Python&lt;br /&gt;
** LabRPS_Scripting_Basics|Python in LabRPS&lt;br /&gt;
** Macros|Macros&lt;br /&gt;
** Scripted_objects|Parametric objects&lt;br /&gt;
** Scripting_and_macros|Code examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SEARCH&lt;br /&gt;
&lt;br /&gt;
* Help &amp;amp; Feedback&lt;br /&gt;
&lt;br /&gt;
** http://labrps.com/boards|Forum&lt;br /&gt;
** http://www.labrps.com/tracker/|Bugs tracker&lt;br /&gt;
** http://www.facebook.com/LabRPS|Facebook&lt;br /&gt;
** http://www.twitter.com/LabRPSNews|Twitter&lt;br /&gt;
&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* LANGUAGES&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeismicLab&amp;diff=2681</id>
		<title>Plugin SeismicLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeismicLab&amp;diff=2681"/>
		<updated>2025-02-09T20:16:59Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeismicLab Plugin&lt;br /&gt;
|Description=This plugin implement various SeismicLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Abrahamson_Coherence_Function|Abrahamson Coherence Function]], [[#Harichandran_Vanmarcke_Coherence_Function|Harichandran-Vanmarcke Coherence Function]], [[#Loh_and_Lin_Coherence_Function|Loh and Lin Coherence Function]], [[#Tajimi_Kanai_Spectrum|Tajimi-Kanai Spectrum]], [[#Clough_Penzien_Spectrum|Clough-Penzien Spectrum]], [[#Kougioumtzoglou_And_Spano_Spectrum_2009|Kougioumtzoglou And Spano Spectrum 2009]], [[#Bogdanoff_Goldberg_Bernard_Modulation_Function|Bogdanoff Goldberg Bernard Modulation Function]], [[#Box_Car_Modulation_Function|Box Car Modulation Function]], [[#Constant_Modulation_Function|Constant Modulation Function]], [[#Exponential_Modulation_Function|Exponential Modulation Function]], [[#Jennings_Modulation_Function|Jennings Modulation Function]], [[#Saragoni_and_Hart_Modulation_Function|Saragoni and Hart Modulation Function]], [[#Trapezoidal_Modulation_Function|Trapezoidal Modulation Function]], [[#Exponential_Wave_Passage_Effect|Exponential Wave Passage Effect]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeismicLab/SeismicLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of seismic ground motion. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute seismic ground motion simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeismicLab.installPlugin(&amp;quot;SeismicLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeismicLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute seismic ground motion simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeismicLab.installPlugin(&amp;quot;SeismicLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeismicLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeismicLab.installPlugin(&amp;quot;SeismicLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeismicLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeismicLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeismicLab_Tutorial001_Pic005_SeismicLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeismicLab.installPlugin(&amp;quot;SeismicLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeismicLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeismicLab_Tutorial001_Pic006_SeismicLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeismicLab.installPlugin(&amp;quot;SeismicLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeismicLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of seismic ground motion, one common technique is to represent the seismic ground motion as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeismicLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeismicLab.installPlugin(&amp;quot;SeismicLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeismicLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeismicLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Abrahamson Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Coherence|coherence]] group. The Abrahamson coherence function has the advantage that it can be used for a broad range of soil &lt;br /&gt;
conditions.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = \frac{1}{1 + \left[\frac{\omega}{2{\pi}C_8(\xi_{jk})}\right]^6}\times tanh\left \{ \frac{C_3(\xi_{jk})}{1 + \frac{\omega}{2\pi}C_4(\xi_{jk}) + \frac{\omega^2}{4\pi^2}C_7(\xi_{jk})} + \left [ 4.80 -  C_3(\xi_{jk})\right ]exp\left [ C_6(\xi_{jk})\frac{\omega}{2\pi} \right ] + 0.35        \right \}  ;\quad j,k = 1, 2, 3, ..., n;\quad {j} \neq {k}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;C_3 = \frac{3.95}{(1+0.0077\xi_{jk}+0.000023\xi^2_{jk})} + 0.85exp\left(-0.00013\xi_{jk}\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;C_4 = \frac{0.4\left [1- \frac{1}{1+\left ( \frac{\xi_{jk}}{5} \right )^3} \right ]}{\left [ 1+\left ( \frac{\xi_{jk}}{190} \right )^8 \right ]\left [ 1+\left ( \frac{\xi_{jk}}{180} \right )^3 \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;C_6 = 3\left [ exp\left ( -\frac{\xi_{jk}}{20} \right )  - 1\right]-0.0018\xi_{jk}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;C_7 = -0.598 + 0.106ln\left ( \xi_{jk} +325 \right ) - 0.0151exp\left ( -0.6 \xi_{jk} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;C_8 = exp\left [ 8.54 - 1.07ln\left ( \xi_{jk} +200 \right ) \right ] + 100exp\left ( -\xi_{jk} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the coherence value between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\xi_{jk}&amp;lt;/math&amp;gt; is the distance between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization]] feature&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Abrahamson Coherence Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Coherence Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    coherence = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not coherence:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the coherence function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross coherence matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
    frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
    # compute the coherence matrix at time instant of 0 second and frequency of 0.25 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution, the active frequency discretization&lt;br /&gt;
    # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If SeismicLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    coherences = sim.computeCrossCoherenceMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(coherences), len(coherences[0]), coherences)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Harichandran Vanmarcke Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Coherence|coherence]] group. The following empirical coherence function was proposed by Harichandran and Vanmarcke:&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = Aexp\left [ -\frac{2\xi_{jk}}{\alpha\theta(\omega)}\left ( 1 - A + \alpha A \right ) \right ] + (1 - A)exp\left [ -\frac{2\xi_{jk}}{\theta(\omega)}\left ( 1 - A + \alpha A \right ) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\theta(\omega) = k\left [ 1+ \left ( \frac{\omega}{\omega_0} \right )^b \right ]^{-\frac{1}{2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the coherence value between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\xi_{jk}&amp;lt;/math&amp;gt; is the distance between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ParameterA}}: The parameter A.&lt;br /&gt;
* {{PropertyData|ParameterAlpha}}: The parameter Alpha.&lt;br /&gt;
* {{PropertyData|ParameterK}}: The parameter K.&lt;br /&gt;
* {{PropertyData|ParameterOmegaZero}}: The parameter omega zero.&lt;br /&gt;
* {{PropertyData|ParameterB}}: The parameter b.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Harichandran-Vanmarcke Coherence Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Coherence Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    coherence = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not coherence:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the coherence function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(coherence)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross coherence matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
    frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
    # compute the coherence matrix at time instant of 0 second and frequency of 0.25 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution, the active frequency discretization&lt;br /&gt;
    # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If SeismicLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    coherences = sim.computeCrossCoherenceMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(coherences), len(coherences[0]), coherences)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Loh and Lin Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Coherence|coherence]] group. The following empirical coherence function was proposed by Harichandran and Vanmarcke:&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = exp\left [ -\left ( \alpha + B\omega^2 \right )\xi_{jk} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the coherence value between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\xi_{jk}&amp;lt;/math&amp;gt; is the distance between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ParameterAlpha}}: The natural frequency of the ground.&lt;br /&gt;
* {{PropertyData|ParameterB}}: The damping ratio of the ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Loh and Lin Coherence Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Coherence Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    coherence = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not coherence:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the coherence function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(coherence)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross coherence matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
    frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
    # compute the coherence matrix at time instant of 0 second and frequency of 0.25 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution, the active frequency discretization&lt;br /&gt;
    # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If SeismicLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    coherences = sim.computeCrossCoherenceMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(coherences), len(coherences[0]), coherences)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Tajimi Kanai Spectrum ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[SeismicLab_Feature#Spectrum|spectrum]] group. The Tajimi-Kanai Spectrum model assumes that the movement process of rock caused by earthquake is an ideal white noise process with zero mean value, and the overburden layer is simplified as a linear single degree of freedom system (a second-order linear lowpass filter).&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{\omega^4_g + \left ( 2\beta_g\omega_g\omega \right )^2}{\left ( \omega^2_g - \omega^2 \right )^2 + \left ( 2\beta_g\omega_g\omega \right )^2}S_0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;S(\omega)&amp;lt;/math&amp;gt; is power spectral density at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Coherence| coherence function]] feature may also be needed&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|GroundNaturalFrequency}}: The natural frequency of the ground.&lt;br /&gt;
* {{PropertyData|GroundDampingRatio}}: The damping ratio of the ground.&lt;br /&gt;
* {{PropertyData|ConstantSpectralIntensity}}: The shaking intensity of the ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Tajimi-Kanai Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
&lt;br /&gt;
    spectrum.GroundNaturalFrequency = &#039;2.48 1/s&#039;&lt;br /&gt;
    spectrum.GroundDampingRatio = 0.55&lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
    frequency = 2.1539658744&lt;br /&gt;
&lt;br /&gt;
    # compute the spectrum matrix at time instant of 0 second and frequency of 2.4828171151 hz&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # the active coherence function. It will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If SeismicLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Clough Penzien Spectrum ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[SeismicLab_Feature#Spectrum|spectrum]] group. The model has clear physical significance. That is, it fully considers the filtering effect of site soil layer on rock motion, and the spectral characteristics are more in line with the actual site. Therefore, the Tajimi-Kanai model has become one of the mostwidely used stochastic stationary models of strong ground motion. However, the model also has some obvious defects.Specifically:&lt;br /&gt;
* The Tajimi-Kanai model overestimates the low-frequency components of ground motion, which may give unreasonable results when used in the random seismic response analysis of lowfrequency structures.&lt;br /&gt;
* The Tajimi-Kanai model has singular points at zero frequency and does not satisfy the continuous quadratic integrability condition. The variance of ground velocity and ground displacement derived from it is infinite.&lt;br /&gt;
* The Tajimi-Kanai model assumes that the ground acceleration of rock is the Gaussian white noise. It can&#039;t adequately reflect the spectral characteristics of rock motion.&lt;br /&gt;
Clough Penzien proposed a method to modify the low frequency energy of the Tajimi-Kanai spectral model as follows:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{\omega^4}{\left ( \omega^2_f - \omega^2 \right )^2 + \left ( 2\beta_f\omega_f\omega \right )^2}\times\frac{\omega^4_g + \left ( 2\beta_g\omega_g\omega \right )^2}{\left ( \omega^2_g - \omega^2 \right )^2 + \left ( 2\beta_g\omega_g\omega \right )^2}S_0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;S(\omega)&amp;lt;/math&amp;gt; is power spectral density at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Coherence| coherence function]] feature may also be needed&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|GroundNaturalFrequency}}: The natural frequency of the ground.&lt;br /&gt;
* {{PropertyData|GroundDampingRatio}}: The damping ratio of the ground.&lt;br /&gt;
* {{PropertyData|SecondFilterLayerFrequency}}: The frequency of the second  filter layer.&lt;br /&gt;
* {{PropertyData|SecondFilterLayerDampingRatio}}: The damping ratio of the second  filter layer.&lt;br /&gt;
* {{PropertyData|ConstantSpectralIntensity}}: The shaking intensity of the ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Clough-Penzien Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
&lt;br /&gt;
    spectrum.GroundNaturalFrequency = &#039;2.4828171151 1/s&#039;&lt;br /&gt;
    spectrum.GroundDampingRatio = 0.55&lt;br /&gt;
    spectrum.SecondFilterLayerFrequency = &#039;0.2482817115 1/s&#039;&lt;br /&gt;
    spectrum.SecondFilterLayerDampingRatio = 0.8&lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
    frequency = 2.1539658744&lt;br /&gt;
&lt;br /&gt;
    # compute the spectrum matrix at time instant of 0 second and frequency of 2.4828171151 hz&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # the active coherence function. It will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If SeismicLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hu Zhou Spectrum ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[SeismicLab_Feature#Spectrum|spectrum]] group. Hu Zhou proposed a method to modify the low frequency energy of the Tajimi-Kanai spectral model as follows:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{\omega^6}{ \omega^6 +  \omega^6_c}\times\frac{\omega^4_g + \left ( 2\beta_g\omega_g\omega \right )^2}{\left ( \omega^2_g - \omega^2 \right )^2 + \left ( 2\beta_g\omega_g\omega \right )^2}S_0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;S(\omega)&amp;lt;/math&amp;gt; is power spectral density at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Coherence| coherence function]] feature may also be needed&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|GroundNaturalFrequency}}: The natural frequency of the ground.&lt;br /&gt;
* {{PropertyData|GroundDampingRatio}}: The damping ratio of the ground.&lt;br /&gt;
* {{PropertyData|LowFrequencyControlFactor}}: The low frequency control factor.&lt;br /&gt;
* {{PropertyData|ConstantSpectralIntensity}}: The shaking intensity of the ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Clough-Penzien Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
&lt;br /&gt;
    spectrum.GroundNaturalFrequency = &#039;2.4828171151 1/s&#039;&lt;br /&gt;
    spectrum.GroundDampingRatio = 0.55&lt;br /&gt;
    spectrum.SecondFilterLayerFrequency = &#039;0.2482817115 1/s&#039;&lt;br /&gt;
    spectrum.SecondFilterLayerDampingRatio = 0.8&lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
    frequency = 2.1539658744&lt;br /&gt;
&lt;br /&gt;
    # compute the spectrum matrix at time instant of 0 second and frequency of 2.4828171151 hz&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # the active coherence function. It will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If SeismicLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kougioumtzoglou And Spano Spectrum 2009 ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[SeismicLab_Feature#Spectrum|spectrum]] group. The model proposed by Kougioumtzoglou And Spano is a non-separable power spectrum expressed as follows: &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega,t) = S\left ( \frac{\omega}{5\pi} \right )^2exp\left (-0.15t\right )t^2exp\left [ -\left ( \frac{\omega}{5\pi} \right )^2t \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;S(\omega,t)&amp;lt;/math&amp;gt; is power spectral density at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization]] feature&lt;br /&gt;
* A [[RPS_Feature_Group#Coherence| coherence function]] feature may also be needed&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ConstantS}}: The constant S.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Kougioumtzoglou And Spano Spectrum 2009&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.Stationarity = False&lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0.25 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.25&lt;br /&gt;
    frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
    # compute the spectrum matrix at time instant of 0 second and frequency of 0.25 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # the active coherence function. It will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If SeismicLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArrayAsMatrix(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bogdanoff Goldberg Bernard Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Modulation_Function|modulation function]] group. The Bogdanoff Goldberg Bernard modulation function is a uniform (not dependent on frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;) modulation function expressed as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(\omega,t) = c_1t\mbox{exp}\left ( -c_2t \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;A(\omega,t)&amp;lt;/math&amp;gt; is the modulation function at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;c_2&amp;lt;/math&amp;gt; are coefficients.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|CoefficientOne}}: The coefficient 1.&lt;br /&gt;
* {{PropertyData|CoefficientTwo}}: The coefficient 2..&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;. &lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bogdanoff Goldberg Bernard Modulation Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    modulation = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not modulation:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(modulation)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the modulation for the frequency value of 0.0 rad/s.&lt;br /&gt;
    frequency = 0.00&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
&lt;br /&gt;
    # compute the modulation function for frequency of 0.00 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution,&lt;br /&gt;
    # If SeismicLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    modulations = sim.computeModulationVectorT(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(modulations), len(modulations[0]), modulations, False)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Box Car Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Modulation_Function|modulation function]] group. The Box Car modulation function is a kind of constant uniform (not dependent on frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;) modulation function expressed as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(\omega,t) =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
A_0,   &amp;amp; \mbox{for } 0 \le t \le T_0 \\&lt;br /&gt;
0, &amp;amp; \mbox{for } t &amp;gt; T_0&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;A(\omega,t)&amp;lt;/math&amp;gt; is the modulation function at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;A_0&amp;lt;/math&amp;gt; is a constant.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ScalingFactor}}: This is the scaling factor.&lt;br /&gt;
* {{PropertyData|StrongMotionDuration}}: This is the strong motion duration of the earthquake excitation.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;. &lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Box Car Modulation Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    modulation = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not modulation:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(modulation)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the modulation for the frequency value of 0.0 rad/s.&lt;br /&gt;
    frequency = 0.00&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
&lt;br /&gt;
    # compute the modulation function for frequency of 0.00 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution,&lt;br /&gt;
    # If SeismicLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    modulations = sim.computeModulationVectorT(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(modulations), len(modulations[0]), modulations, False)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Constant Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Modulation_Function|modulation function]] group. The Box Car modulation function is a kind of constant uniform (not dependent on frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;) modulation function expressed as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(\omega,t) = A_0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;A(\omega,t)&amp;lt;/math&amp;gt; is the modulation function at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;A_0&amp;lt;/math&amp;gt; is a constant.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ConstantModulationValue}}: The constant modulation value.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;. &lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Constant Modulation Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    modulation = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not modulation:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(modulation)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the modulation for the frequency value of 0.0 rad/s.&lt;br /&gt;
    frequency = 0.00&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
&lt;br /&gt;
    # compute the modulation function for frequency of 0.00 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution,&lt;br /&gt;
    # If SeismicLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    modulations = sim.computeModulationVectorT(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(modulations), len(modulations[0]), modulations, False)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Modulation_Function|modulation function]] group. The Box Car modulation function is a kind of constant uniform (not dependent on frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;) modulation function expressed as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(\omega,t) = A_0\left ( e^{-\alpha t} - e^{-\beta t} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;A(\omega,t)&amp;lt;/math&amp;gt; is the modulation function at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;A_0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; are constants.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Alpha}}: The parameter alpha.&lt;br /&gt;
* {{PropertyData|Beta}}: The parameter beta.&lt;br /&gt;
* {{PropertyData|CoefficientA}}: The internal coefficient A.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;. &lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Exponential Modulation Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    modulation = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not modulation:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(modulation)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the modulation for the frequency value of 0.0 rad/s.&lt;br /&gt;
    frequency = 0.00&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
&lt;br /&gt;
    # compute the modulation function for frequency of 0.00 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution,&lt;br /&gt;
    # If SeismicLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    modulations = sim.computeModulationVectorT(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(modulations), len(modulations[0]), modulations, False)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jennings Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Modulation_Function|modulation function]] group. The Jennings modulation function is a piecewise uniform (not dependent on frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;) modulation function expressed as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(\omega,t) =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\left ( \frac{t}{t_1} \right )^p,   &amp;amp; \mbox{for } 0 \le t \le t_1 \\&lt;br /&gt;
\\&lt;br /&gt;
1,   &amp;amp; \mbox{for } t_1 &amp;lt; t \le t_2 \\&lt;br /&gt;
\\&lt;br /&gt;
\mbox{exp}\left [ -\alpha\left ( t-t_2 \right ) \right ]   &amp;amp; \mbox{for } t &amp;gt; t_2&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;A(\omega,t)&amp;lt;/math&amp;gt; is the modulation function at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; are constants.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|RiseTime}}: The instant of time (in sec) corresponding to the beginning of the horizontal part of the envelope..&lt;br /&gt;
* {{PropertyData|LevelTime}}: The instant of time corresponding to the beginning of the descending branch of the envelope. The Level Time should be larger than the Rise Time.&lt;br /&gt;
* {{PropertyData|Alpha}}: The parameter alpha.&lt;br /&gt;
* {{PropertyData|Power}}: The power coefficient.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;. &lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jennings Modulation Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    modulation = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not modulation:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(modulation)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the modulation for the frequency value of 0.0 rad/s.&lt;br /&gt;
    frequency = 0.00&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
&lt;br /&gt;
    # compute the modulation function for frequency of 0.00 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution,&lt;br /&gt;
    # If SeismicLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    modulations = sim.computeModulationVectorT(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(modulations), len(modulations[0]), modulations, False)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Saragoni and Hart Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Modulation_Function|modulation function]] group. The Saragoni and Hartmodulation function is a uniform (not dependent on frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;) modulation function expressed as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(\omega,t) = \alpha_1t^{\alpha_2-1}\mbox{e}^{-\alpha_3t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;A(\omega,t)&amp;lt;/math&amp;gt; is the modulation function at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\alpha_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\alpha_3&amp;lt;/math&amp;gt; are constants.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|AlphaOne}}: The parameter 1.&lt;br /&gt;
* {{PropertyData|AlphaTwo}}: The parameter 2.&lt;br /&gt;
* {{PropertyData|AlphaThree}}: The parameter 3.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;. &lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Saragoni and Hart Modulation Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    modulation = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not modulation:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(modulation)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the modulation for the frequency value of 0.0 rad/s.&lt;br /&gt;
    frequency = 0.00&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
&lt;br /&gt;
    # compute the modulation function for frequency of 0.00 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution,&lt;br /&gt;
    # If SeismicLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    modulations = sim.computeModulationVectorT(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(modulations), len(modulations[0]), modulations, False)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Trapezoidal Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature belongs to the [[RPS_Feature_Group#Modulation_Function|modulation function]] group. The Trapezoidal modulation function is a uniform (not dependent on frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;) modulation function expressed as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(\omega,t) =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\frac{t}{t_1},   &amp;amp; \mbox{for } 0 \le t \le t_1 \\&lt;br /&gt;
\\&lt;br /&gt;
1,   &amp;amp; \mbox{for } t_1 &amp;lt; t \le t_2 \\&lt;br /&gt;
\\&lt;br /&gt;
\frac{t-t_3}{t_2 - t_3}   &amp;amp; \mbox{for } t_2 &amp;lt; t \le t_3 \\&lt;br /&gt;
\\&lt;br /&gt;
0   &amp;amp; \mbox{for } t &amp;gt; t_3 &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;A(\omega,t)&amp;lt;/math&amp;gt; is the modulation function at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points]] feature&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|RiseTime}}: This is the instant of time (in sec) corresponding to the beginning of the horizontal part of the envelope.&lt;br /&gt;
* {{PropertyData|LevelTime}}: This is the instant of time corresponding to the beginning of the descending branch of the envelope. The Level Time should be larger than the Rise Time.&lt;br /&gt;
* {{PropertyData|MaxTime}}: The Duration.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeismicLab simulation with &lt;br /&gt;
# active simulation points&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeismicLab simulation called &amp;quot;Simulation&amp;quot;. &lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Trapezoidal Modulation Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeismicLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    modulation = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not modulation:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    sim.setActiveFeature(modulation)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the modulation for the frequency value of 0.0 rad/s.&lt;br /&gt;
    frequency = 0.00&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
&lt;br /&gt;
    # compute the modulation function for frequency of 0.00 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeismicLab will try to identify the active locations distribution,&lt;br /&gt;
    # If SeismicLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    modulations = sim.computeModulationVectorT(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(modulations), len(modulations[0]), modulations, False)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Wave Passage Effect ==&lt;br /&gt;
&lt;br /&gt;
The wave passage effect is a measure of the wave passage delay due to the apparent velocity of waves, which is one of spatially varying properties of multivariate random processes. The exponential Wave Passage effect is expressed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = \mbox{exp}\left ( -i\frac{\omega \times \xi_{jk}}{v_{app}} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the wave passage effect between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\xi_{jk}&amp;lt;/math&amp;gt; is the distance between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ApparentWaveVelocity}}: The apparent wave velocity.&lt;br /&gt;
* {{PropertyData|Coefficient}}: The appropriate coefficient that can obtained from experiments.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeismicLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeismicLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeismicLab.installPlugin(&amp;quot;SeismicLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeismicLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Exponential Wave Passage Effect&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Wave Passage Effect&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeismicLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set simulation parameters&lt;br /&gt;
    sim.NumberOfFrequency = 2048&lt;br /&gt;
    sim.MaxFrequency = &amp;quot;0.64 Hz&amp;quot; # 4 rad/s;&lt;br /&gt;
    sim.FrequencyIncrement = &amp;quot;0.00031 Hz&amp;quot; # 0.00195 rad/s;&lt;br /&gt;
     &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to compute the wave passage effect which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active wave passage effect in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the wave passage effect between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeismicLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active wave passage effect feature, and others. If SeismicLab fails to find any of these dependency features, &lt;br /&gt;
    # the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    effect13 = sim.computeWavePassageEffectVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(effect13), len(effect13[0]), effect13)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_WindLab&amp;diff=2680</id>
		<title>Plugin WindLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_WindLab&amp;diff=2680"/>
		<updated>2025-02-09T20:02:52Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=WindLab Plugin&lt;br /&gt;
|Description=This plugin implement various WindLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Power_Law_Profile|Power Law Profile]], [[#Logarithmic_Law_Profile|Logarithmic Law Profile]], [[#Deaves_and_Harris_Profile|Deaves and Harris Profile]], [[#Sine_Modulation_Function|Sine Modulation Function]], [[#Three_Parameter_Modulation_Function|Three Parameter Modulation Function]], [[#Exponential_Modulation_Function|Exponential Modulation Function]], [[#Davenport_Coherence_Function|Davenport Coherence Function]], [[#Krenk_Coherence_Function|Krenk Coherence Function]], [[#Davenport_Along_Wind_Spectrum|Davenport Along Wind Spectrum]], [[#Harris_Along_Wind_Spectrum|Harris Along Wind Spectrum]], [[#Kaimal_Along_Wind_Spectrum|Kaimal Along Wind Spectrum]], [[#Kaimal_Across_Wind_Spectrum|Kaimal Across Wind Spectrum]], [[#Kaimal_Vertical_Wind_Spectrum|Kaimal Vertical Wind Spectrum]], [[#Simiu_Along_Wind_Spectrum|Simiu Along Wind Spectrum]], [[#Simiu_Across_Wind_Spectrum|Simiu Across Wind Spectrum]], [[#Simiu_Vertical_Wind_Spectrum|Simiu Vertical Wind Spectrum]], [[#von_Karman_Along_Wind_Spectrum|von Karman Along Wind Spectrum]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#George_Deodatis_Simulation_Method_1996|George Deodatis Simulation Method(1996)]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Exponential_Wave_Passage_Effect|Exponential Wave Passage effect]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/WindLab/WindLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random wind velocity. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random wind simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random wind simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:WindLab_Tutorial001_Pic005_WindLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:WindLab_Tutorial001_Pic006_WindLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Power Law Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the power law mean wind profile, which is commonly used to model the variation of wind speed with height in the atmospheric boundary layer. This model is essential in fields such as wind energy, structural engineering, and environmental science. The power law formula that governs the relationship between wind speed and height is expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) = U(z_0)\times\left( \frac{{z-\phi}}{z_0} \right)^\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z_0)&amp;lt;/math&amp;gt; is the reference wind speed at a known reference height &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is the power law exponent, a dimensionless constant that varies depending on terrain and atmospheric conditions,&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ReferenceHeight}}: This is a reference height.&lt;br /&gt;
* {{PropertyData|ReferenceSpeed}}: This is the reference wind speed at the reference height.&lt;br /&gt;
* {{PropertyData|DimensionlessPower}}: This is the power law exponent.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: This is the zero plan displacement.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Power Law Profile&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not meanSpeed:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    meanSpeed.ReferenceHeight = &#039;10.00 m&#039;&lt;br /&gt;
    meanSpeed.ReferenceSpeed = &#039;30.00 m/s&#039;&lt;br /&gt;
    meanSpeed.DimensionlessPower = 0.12&lt;br /&gt;
    meanSpeed.ZeroPlanDisplacement = &#039;0.0 m&#039;&lt;br /&gt;
&lt;br /&gt;
    # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
    # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
    # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
    # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
    # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
    # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 2, meanValues, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Logarithmic Law Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the logarithmic law mean wind profile. The logarithmic law is commonly used to model the variation of wind speed with height in the atmospheric boundary layer, especially in cases where the wind profile is influenced by surface roughness, such as over flat terrain, forests, or urban environments. The logarithmic law for wind speed variation is given by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) =\left( \frac{u_*}{k} \right)\times\ln{\left( \frac{{z-\phi}}{z_0} \right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_*&amp;lt;/math&amp;gt;  is the friction velocity, which is a measure of the turbulence intensity,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is the von Kármán constant (approximately 0.4),&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt; is the roughness length, which characterizes the roughness of the surface,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TerrainRoughness}}: This is the terrain roughness value.&lt;br /&gt;
* {{PropertyData|ShearVelocity}}: This is the shear velocity of the flow.&lt;br /&gt;
* {{PropertyData|vonKarmanConstant}}: This is the von karman constant.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: This is the zero plan displacement value.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Logarithmic Law Profile&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not meanSpeed:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 meanSpeed.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
 meanSpeed.ShearVelocity = &#039;1.76 m/s&#039; &lt;br /&gt;
&lt;br /&gt;
 # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
&lt;br /&gt;
 # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Deaves and Harris Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the logarithmic law mean wind profile. The logarithmic law is commonly used to model the variation of wind speed with height in the atmospheric boundary layer, especially in cases where the wind profile is influenced by surface roughness, such as over flat terrain, forests, or urban environments. The logarithmic law for wind speed variation is given by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) =\left( \frac{u_*}{k} \right)\times\left [\ln{\left( \frac{{z-z_d}}{z_0} \right)} + 5.75\left( \frac{{z-z_d}}{h} \right) - 1.88\left( \frac{{z-z_d}}{h} \right)^2 - 1.33\left( \frac{{z-z_d}}{h} \right)^3 + 0.25\left( \frac{{z-z_d}}{h} \right)^4\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_*&amp;lt;/math&amp;gt;  is the friction velocity, which is a measure of the turbulence intensity,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is the von Kármán constant (approximately 0.4),&lt;br /&gt;
* &amp;lt;math&amp;gt;z_d&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt; is the roughness length, which characterizes the roughness of the surface,&lt;br /&gt;
* &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is the gradient height, deﬁned as the height where atmospheric ﬂow is free from surface stresses and becomes geostrophic,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TerrainRoughness}}: The terrain roughness length.&lt;br /&gt;
* {{PropertyData|ShearVelocity}}: The shear velocity of the flow.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: The zero plan displacement.&lt;br /&gt;
* {{PropertyData|Latitude}}: The latitude.&lt;br /&gt;
* {{PropertyData|EarthAngularVelocity}}: The earth angular velocity.&lt;br /&gt;
* {{PropertyData|Betta}}: The coefficient beta.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Deaves and Harris Profile&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not meanSpeed:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 meanSpeed.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
 meanSpeed.ShearVelocity = &#039;1.76 m/s&#039; &lt;br /&gt;
&lt;br /&gt;
 # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
&lt;br /&gt;
 # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Sine Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as a sine wave, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = sin\left( \frac{\pi\times t}{T} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;  is the pulse duration,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Randomness| randomness provider feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PulseDuration}}: The pusle duration.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Sine Wave Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.PulseDuration= &#039;150 m/s&#039;&lt;br /&gt;
 &lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Three Parameter Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as an exponential function, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = \alpha t^\beta e^{-\lambda t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;  is the alpha coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;\beta &amp;lt;/math&amp;gt;  is the beta coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;\lambda &amp;lt;/math&amp;gt;  is the lambda coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Alpha}}: The alpha coefficient.&lt;br /&gt;
* {{PropertyData|Betta}}: The beta coefficient.&lt;br /&gt;
* {{PropertyData|Lambda}}: The lambda coefficient.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Three Parameter Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.Alpha = 4.98&lt;br /&gt;
 modulation.Betta = 3.00&lt;br /&gt;
 modulation.Lambda = 0.003&lt;br /&gt;
&lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as an exponential function, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = exp\left[-\frac{1}{2}\left( \frac{t-t_{m} }{t_{l}} \right)^2\right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;t_{m}&amp;lt;/math&amp;gt;  is the time when the modulation function reaches its maximum,&lt;br /&gt;
* &amp;lt;math&amp;gt;t_{l}&amp;lt;/math&amp;gt;  is the storm length,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TimeOfMax}}: The time when the modulation function reaches its maximum.&lt;br /&gt;
* {{PropertyData|StormLength}}: The storm length.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Exponential Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.TimeOfMax = &#039;300 s&#039;&lt;br /&gt;
 modulation.StormLength = &#039;60 s&#039;&lt;br /&gt;
&lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Davenport Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this feature is to model the spatial correlation of wind velocities, which is crucial in many engineering applications, especially in the context of wind turbine design, structural analysis, and environmental studies. The Davenport Coherence Function quantifies the correlation between the wind velocity at two points, in space (at different locations). It is derived from the theory of wind turbulence and helps in simulating the correlated behavior of wind speeds over a geographical area. The mathematical form of the Davenport Coherence Function, for two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; is expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = exp\left[-\frac{\omega}{2 \pi}\left( \frac{\sqrt{C_{x}^2 \left( x_{j}-x_{k} \right)^2 + C_{y}^2 \left( y_{j}-y_{k} \right)^2 + C_{z}^2 \left( z_{j}-z_{k} \right)^2}}{\frac{U_{j}\left( z_{j} \right)+U_{k}\left( z_{k} \right)}{2}} \right)\right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the coherence value between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{x}&amp;lt;/math&amp;gt;  is the decay coefficient along x,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{y}&amp;lt;/math&amp;gt;  is the decay coefficient along y,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{z}&amp;lt;/math&amp;gt;  is the decay coefficient along z,&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{j}\left( z_{j} \right)&amp;lt;/math&amp;gt;  is the mean wind speed at altitude &amp;lt;math&amp;gt;z_{j}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{k}\left( z_{k} \right)&amp;lt;/math&amp;gt;  is the mean wind speed at altitude &amp;lt;math&amp;gt;z_{k}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ExponentialDecayCx}}: The decay coefficient along x.&lt;br /&gt;
* {{PropertyData|ExponentialDecayCy}}: The decay coefficient along y&lt;br /&gt;
* {{PropertyData|ExponentialDecayCz}}: The decay coefficient along z&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Davenport Coherence Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Coherence Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 coherence = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not coherence:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the coherence function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 coherence.ExponentialDecayCx = 10.0&lt;br /&gt;
 coherence.ExponentialDecayCy = 7.0&lt;br /&gt;
 coherence.ExponentialDecayCz = 6.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, coherence function can vary with time. In case the user desires a time dependent coherence function,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # coherence function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 coherences = sim.computeCrossCoherenceMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(coherences)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Krenk Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
Documentation coming soon.&lt;br /&gt;
&lt;br /&gt;
== Davenport Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Davenport spectrum is widely used in wind engineering to model the [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] of wind velocity in its main direction. The Davenport Power Spectrum or Davenport Wind Spectrum, can be mathematically expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(n)}{u_{*}^2} = k\frac{x^2}{\left(1 + x^2 \right)^{4/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;x = \frac{1200n}{U_{10}}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;  is the von Karman constant which is equal to 4.0,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{10}&amp;lt;/math&amp;gt; is the mean wind speed at height of 10 meters.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MeanWindSpeed10}}: The mean wind speed at height of 10 meters&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Davenport Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.MeanWindSpeed10= &#039;30.0 m/s&#039;&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Harris Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Harris spectrum is widely used in wind engineering to model the [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] of wind velocity in its main direction. The Harris Power Spectrum or Harris Wind Spectrum, can be mathematically expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(n)}{u_{*}^2} = k\frac{x^2}{\left(2 + x^2 \right)^{5/6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;x = \frac{1800n}{U_{10}}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;  is the von Karman constant which is equal to 4.0,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{10}&amp;lt;/math&amp;gt; is the mean wind speed at height of 10 meters.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MeanWindSpeed10}}: The mean wind speed at height of 10 meters&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Harris Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.MeanWindSpeed10= &#039;30.0 m/s&#039;&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{200f}{\left(1 + 50f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 200.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 50.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 200.0&lt;br /&gt;
 spectrum.Constant2 = 50.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Across Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Across_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal across wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{15f}{\left(1 + 9.5f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 15.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 9.5 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Across Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Across Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 15.0&lt;br /&gt;
 spectrum.Constant2 = 9.5&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeYCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Vertical Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Vertical_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal vertical spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{3.36f}{1 + 10f^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 3.36 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 10.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 3.36&lt;br /&gt;
 spectrum.Constant2 = 10.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeZCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{105f}{\left(1 + 33f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 105.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 33.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 105.0&lt;br /&gt;
 spectrum.Constant2 = 33.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Across Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Across_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu across wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{17f}{\left(1 + 9.5f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 17.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 9.5 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Across Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Across Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 17.0&lt;br /&gt;
 spectrum.Constant2 = 9.5&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeYCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Vertical Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Vertical_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu vertical spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{2f}{1 + 5.3f^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 2 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 5.3 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 2&lt;br /&gt;
 spectrum.Constant2 = 5.3&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeZCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== von Karman Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The von Karman Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The von Karman model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the von Karman along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{\sigma_{u}^2} = \frac{4f}{\left(1 + 70.8f^2 \right)^{5/6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nL_u}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\sigma_{u}&amp;lt;/math&amp;gt;  is the standard  deviation,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|StandardDeviation}}: The standard  deviation&lt;br /&gt;
* {{PropertyData|IntegralLengthScale}}: The integral length scale&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 4.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 70.8.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;von Karman Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.StandardDeviation = &#039;1 m/s&#039;&lt;br /&gt;
 spectrum.IntegralLengthScale = &#039;80 m&#039;&lt;br /&gt;
 spectrum.Constant1 = 4.0&lt;br /&gt;
 spectrum.Constant2 = 70.8.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random wind velocity, one common technique is to represent the wind velocity as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== George Deodatis Simulation Method 1996 ==&lt;br /&gt;
&lt;br /&gt;
The paper &amp;quot;Simulation of Ergodic Multivariate Stochastic Processes&amp;quot; by G. Deodatis (1996) presents a method for simulating multivariate stochastic processes, particularly focusing on ergodic processes. The goal of the paper is to provide an efficient method to simulate multivariate stochastic processes that are ergodic. Ergodic processes are those where time averages of the process can be taken as realizations of the ensemble averages. The method is applicable to a wide range of stochastic processes, particularly those in engineering and environmental sciences (e.g., wind, seismic activity, or oceanography).&lt;br /&gt;
According to the method, the stochastic process &amp;lt;math&amp;gt;f_{j}(t) (j = 1, 2, 3, ..., n)&amp;lt;/math&amp;gt; can be simulated by the following series as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f_{j}(t) = 2\sum_{m=1}^{n}\sum_{l=1}^{N}|H_{jm}(\omega_{ml})|\sqrt{\Delta\omega}\cos\left[\omega_{ml}t+\theta_{jm}(\omega_{ml})+\Phi_{ml}\right];\quad j = 1, 2, 3, ..., n;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;S(\omega) = H(\omega)H^{T*}(\omega)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\theta_{jm}(\omega_{ml}) = tan^{-1}\left(\frac{Im[H_{jm}(\omega_{ml})]}{Re[H_{jm}(\omega_{ml})]}\right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f_{j}(t)&amp;lt;/math&amp;gt; is the wind velocity at time instant &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and location &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
* &amp;lt;math&amp;gt;\Phi_{ml}&amp;lt;/math&amp;gt; are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences of independent random phase angles distributed uniformly over the interval &amp;lt;math&amp;gt;\left [ 0,2\pi \right ]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Refer to the paper for more details. Not that, in LabRPS this feature depends on some other features such as location distribution, mean wind profile, power spectral density, coherence function among others. These dependent features must me be created first. You can run the feature any time and follow the error messages to identify the missing feature that you need to create. You can also refer to the script below to identify all required features. In case you want to obtain the results as presented in the paper, you need to used all the parameters as presented in the paper.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Randomness| randomness provider feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import LabRPS&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import time &lt;br /&gt;
&lt;br /&gt;
def simulate():&lt;br /&gt;
    # Plugin&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
    if not installResuslt:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The installation the WindLabPlugin has failed.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # Document&lt;br /&gt;
    doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # Simulation&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    # set simulation parameters&lt;br /&gt;
    sim.NumberOfFrequency = 2048&lt;br /&gt;
    sim.MaxFrequency = &amp;quot;0.64 Hz&amp;quot; # 4 rad/s;&lt;br /&gt;
    sim.FrequencyIncrement = &amp;quot;0.00031 Hz&amp;quot; # 0.00195 rad/s;&lt;br /&gt;
    sim.TimeIncrement = &amp;quot;0.785 s&amp;quot;&lt;br /&gt;
    sim.NumberOfTimeIncrements = 9651&lt;br /&gt;
&lt;br /&gt;
    # Simulation points&lt;br /&gt;
    loc = WindLabObjects.makeFeature(&amp;quot;SimulationPoints&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;General Distribution&amp;quot;, &amp;quot;Location Distribution&amp;quot;)&lt;br /&gt;
    if not loc:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the location distribution.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    v1 = vec(0, 0, 35)&lt;br /&gt;
    v2 = vec(0, 0, 40)&lt;br /&gt;
    v3 = vec(0, 0, 140)&lt;br /&gt;
    loc.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # Mean wind Profile&lt;br /&gt;
    mean = WindLabObjects.makeFeature(&amp;quot;MeanSpeed&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Logarithmic Law Profile&amp;quot;, &amp;quot;Mean Wind Profile&amp;quot;)&lt;br /&gt;
    if not mean:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the mean wind profile was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    mean.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
    mean.ShearVelocity = &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
    # Frequencies&lt;br /&gt;
    frequency = WindLabObjects.makeFeature(&amp;quot;Frequencies&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Double Index Frequency Discretization&amp;quot;, &amp;quot;Frequency Distribution&amp;quot;)   &lt;br /&gt;
    if not frequency:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency distribution.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # Spectrum&lt;br /&gt;
    spectrum = WindLabObjects.makeFeature(&amp;quot;Spectrum&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Kaimal Along Wind Spectrum&amp;quot;, &amp;quot;Along Wind Spectrum&amp;quot;)&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum model.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Coherence&lt;br /&gt;
    coherence = WindLabObjects.makeFeature(&amp;quot;CoherenceFunction&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Davenport Coherence Function&amp;quot;, &amp;quot;Coherence Function&amp;quot;)&lt;br /&gt;
    if not coherence:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the coherence was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    coherence.ExponentialDecayCz = 10 &lt;br /&gt;
&lt;br /&gt;
    # Spectrum decomposition&lt;br /&gt;
    spectrumD = WindLabObjects.makeFeature(&amp;quot;SpectrumDecomposition&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Cholesky Decomposition&amp;quot;, &amp;quot;Spectrum Decomposition Method&amp;quot;)&lt;br /&gt;
    if not spectrumD:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Random phase&lt;br /&gt;
    randomness = WindLabObjects.makeFeature(&amp;quot;RandomPhases&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Uniform Random Phases&amp;quot;, &amp;quot;Randomness Provider&amp;quot;)&lt;br /&gt;
    if not randomness:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the randomness provider was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # Simulation method&lt;br /&gt;
    simMethod = WindLabObjects.makeFeature(&amp;quot;SimulationMethod&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Deodatis 1996&amp;quot;, &amp;quot;Simulation Method&amp;quot;)&lt;br /&gt;
    if not simMethod:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation method.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Run simulation and output the first(0) sample&lt;br /&gt;
    # store starting time &lt;br /&gt;
    begin = time.time() &lt;br /&gt;
    velocities = sim.simulate(0)&lt;br /&gt;
    # store end time &lt;br /&gt;
    end = time.time()&lt;br /&gt;
    LabRPS.Console.PrintMessage(f&amp;quot;Total runtime of the simulaltion is {end - begin} seconds\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    if LabRPS.GuiUp:&lt;br /&gt;
       import WindLabGui&lt;br /&gt;
       import GeneralToolsGui&lt;br /&gt;
       WindLabGui.setActiveSimulation(sim)&lt;br /&gt;
       GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfTimeIncrements, sim.getSimulationData().numberOfSpatialPosition + 1, velocities, True)&lt;br /&gt;
&lt;br /&gt;
simulate()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, WindLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If WindLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Wave Passage Effect ==&lt;br /&gt;
&lt;br /&gt;
The wave passage effect is a measure of the wave passage delay due to the apparent velocity of waves, which is one of spatially varying properties of multivariate random processes. The exponential Wave Passage effect is expressed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = \mbox{exp}\left ( -i\frac{\omega \times \xi_{jk}}{v_{app}} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the wave passage effect between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\xi_{jk}&amp;lt;/math&amp;gt; is the distance between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ApparentWaveVelocity}}: The apparent wave velocity.&lt;br /&gt;
* {{PropertyData|Coefficient}}: The appropriate coefficient that can obtained from experiments.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Exponential Wave Passage Effect&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Wave Passage Effect&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set simulation parameters&lt;br /&gt;
    sim.NumberOfFrequency = 2048&lt;br /&gt;
    sim.MaxFrequency = &amp;quot;0.64 Hz&amp;quot; # 4 rad/s;&lt;br /&gt;
    sim.FrequencyIncrement = &amp;quot;0.00031 Hz&amp;quot; # 0.00195 rad/s;&lt;br /&gt;
     &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to compute the wave passage effect which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active wave passage effect in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the wave passage effect between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, WindLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active wave passage effect feature, and others. If WindLab fails to find any of these dependency features, &lt;br /&gt;
    # the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    effect13 = sim.computeWavePassageEffectVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(effect13), len(effect13[0]), effect13)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_WindLab&amp;diff=2679</id>
		<title>Plugin WindLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_WindLab&amp;diff=2679"/>
		<updated>2025-02-09T20:01:09Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Exponential Wave Passage effect */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=WindLab Plugin&lt;br /&gt;
|Description=This plugin implement various WindLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Power_Law_Profile|Power Law Profile]], [[#Logarithmic_Law_Profile|Logarithmic Law Profile]], [[#Deaves_and_Harris_Profile|Deaves and Harris Profile]], [[#Sine_Modulation_Function|Sine Modulation Function]], [[#Three_Parameter_Modulation_Function|Three Parameter Modulation Function]], [[#Exponential_Modulation_Function|Exponential Modulation Function]], [[#Davenport_Coherence_Function|Davenport Coherence Function]], [[#Krenk_Coherence_Function|Krenk Coherence Function]], [[#Davenport_Along_Wind_Spectrum|Davenport Along Wind Spectrum]], [[#Harris_Along_Wind_Spectrum|Harris Along Wind Spectrum]], [[#Kaimal_Along_Wind_Spectrum|Kaimal Along Wind Spectrum]], [[#Kaimal_Across_Wind_Spectrum|Kaimal Across Wind Spectrum]], [[#Kaimal_Vertical_Wind_Spectrum|Kaimal Vertical Wind Spectrum]], [[#Simiu_Along_Wind_Spectrum|Simiu Along Wind Spectrum]], [[#Simiu_Across_Wind_Spectrum|Simiu Across Wind Spectrum]], [[#Simiu_Vertical_Wind_Spectrum|Simiu Vertical Wind Spectrum]], [[#von_Karman_Along_Wind_Spectrum|von Karman Along Wind Spectrum]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#George_Deodatis_Simulation_Method_1996|George Deodatis Simulation Method(1996)]], [[#Cholesky_Decomposition|Cholesky Decomposition]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/WindLab/WindLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random wind velocity. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random wind simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random wind simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:WindLab_Tutorial001_Pic005_WindLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:WindLab_Tutorial001_Pic006_WindLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Power Law Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the power law mean wind profile, which is commonly used to model the variation of wind speed with height in the atmospheric boundary layer. This model is essential in fields such as wind energy, structural engineering, and environmental science. The power law formula that governs the relationship between wind speed and height is expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) = U(z_0)\times\left( \frac{{z-\phi}}{z_0} \right)^\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z_0)&amp;lt;/math&amp;gt; is the reference wind speed at a known reference height &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is the power law exponent, a dimensionless constant that varies depending on terrain and atmospheric conditions,&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ReferenceHeight}}: This is a reference height.&lt;br /&gt;
* {{PropertyData|ReferenceSpeed}}: This is the reference wind speed at the reference height.&lt;br /&gt;
* {{PropertyData|DimensionlessPower}}: This is the power law exponent.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: This is the zero plan displacement.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Power Law Profile&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not meanSpeed:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    meanSpeed.ReferenceHeight = &#039;10.00 m&#039;&lt;br /&gt;
    meanSpeed.ReferenceSpeed = &#039;30.00 m/s&#039;&lt;br /&gt;
    meanSpeed.DimensionlessPower = 0.12&lt;br /&gt;
    meanSpeed.ZeroPlanDisplacement = &#039;0.0 m&#039;&lt;br /&gt;
&lt;br /&gt;
    # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
    # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
    # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
    # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
    # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
    # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 2, meanValues, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Logarithmic Law Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the logarithmic law mean wind profile. The logarithmic law is commonly used to model the variation of wind speed with height in the atmospheric boundary layer, especially in cases where the wind profile is influenced by surface roughness, such as over flat terrain, forests, or urban environments. The logarithmic law for wind speed variation is given by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) =\left( \frac{u_*}{k} \right)\times\ln{\left( \frac{{z-\phi}}{z_0} \right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_*&amp;lt;/math&amp;gt;  is the friction velocity, which is a measure of the turbulence intensity,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is the von Kármán constant (approximately 0.4),&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt; is the roughness length, which characterizes the roughness of the surface,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TerrainRoughness}}: This is the terrain roughness value.&lt;br /&gt;
* {{PropertyData|ShearVelocity}}: This is the shear velocity of the flow.&lt;br /&gt;
* {{PropertyData|vonKarmanConstant}}: This is the von karman constant.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: This is the zero plan displacement value.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Logarithmic Law Profile&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not meanSpeed:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 meanSpeed.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
 meanSpeed.ShearVelocity = &#039;1.76 m/s&#039; &lt;br /&gt;
&lt;br /&gt;
 # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
&lt;br /&gt;
 # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Deaves and Harris Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the logarithmic law mean wind profile. The logarithmic law is commonly used to model the variation of wind speed with height in the atmospheric boundary layer, especially in cases where the wind profile is influenced by surface roughness, such as over flat terrain, forests, or urban environments. The logarithmic law for wind speed variation is given by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) =\left( \frac{u_*}{k} \right)\times\left [\ln{\left( \frac{{z-z_d}}{z_0} \right)} + 5.75\left( \frac{{z-z_d}}{h} \right) - 1.88\left( \frac{{z-z_d}}{h} \right)^2 - 1.33\left( \frac{{z-z_d}}{h} \right)^3 + 0.25\left( \frac{{z-z_d}}{h} \right)^4\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_*&amp;lt;/math&amp;gt;  is the friction velocity, which is a measure of the turbulence intensity,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is the von Kármán constant (approximately 0.4),&lt;br /&gt;
* &amp;lt;math&amp;gt;z_d&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt; is the roughness length, which characterizes the roughness of the surface,&lt;br /&gt;
* &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is the gradient height, deﬁned as the height where atmospheric ﬂow is free from surface stresses and becomes geostrophic,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TerrainRoughness}}: The terrain roughness length.&lt;br /&gt;
* {{PropertyData|ShearVelocity}}: The shear velocity of the flow.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: The zero plan displacement.&lt;br /&gt;
* {{PropertyData|Latitude}}: The latitude.&lt;br /&gt;
* {{PropertyData|EarthAngularVelocity}}: The earth angular velocity.&lt;br /&gt;
* {{PropertyData|Betta}}: The coefficient beta.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Deaves and Harris Profile&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not meanSpeed:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 meanSpeed.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
 meanSpeed.ShearVelocity = &#039;1.76 m/s&#039; &lt;br /&gt;
&lt;br /&gt;
 # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
&lt;br /&gt;
 # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Sine Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as a sine wave, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = sin\left( \frac{\pi\times t}{T} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;  is the pulse duration,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Randomness| randomness provider feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PulseDuration}}: The pusle duration.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Sine Wave Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.PulseDuration= &#039;150 m/s&#039;&lt;br /&gt;
 &lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Three Parameter Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as an exponential function, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = \alpha t^\beta e^{-\lambda t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;  is the alpha coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;\beta &amp;lt;/math&amp;gt;  is the beta coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;\lambda &amp;lt;/math&amp;gt;  is the lambda coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Alpha}}: The alpha coefficient.&lt;br /&gt;
* {{PropertyData|Betta}}: The beta coefficient.&lt;br /&gt;
* {{PropertyData|Lambda}}: The lambda coefficient.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Three Parameter Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.Alpha = 4.98&lt;br /&gt;
 modulation.Betta = 3.00&lt;br /&gt;
 modulation.Lambda = 0.003&lt;br /&gt;
&lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as an exponential function, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = exp\left[-\frac{1}{2}\left( \frac{t-t_{m} }{t_{l}} \right)^2\right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;t_{m}&amp;lt;/math&amp;gt;  is the time when the modulation function reaches its maximum,&lt;br /&gt;
* &amp;lt;math&amp;gt;t_{l}&amp;lt;/math&amp;gt;  is the storm length,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TimeOfMax}}: The time when the modulation function reaches its maximum.&lt;br /&gt;
* {{PropertyData|StormLength}}: The storm length.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Exponential Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.TimeOfMax = &#039;300 s&#039;&lt;br /&gt;
 modulation.StormLength = &#039;60 s&#039;&lt;br /&gt;
&lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Davenport Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this feature is to model the spatial correlation of wind velocities, which is crucial in many engineering applications, especially in the context of wind turbine design, structural analysis, and environmental studies. The Davenport Coherence Function quantifies the correlation between the wind velocity at two points, in space (at different locations). It is derived from the theory of wind turbulence and helps in simulating the correlated behavior of wind speeds over a geographical area. The mathematical form of the Davenport Coherence Function, for two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; is expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = exp\left[-\frac{\omega}{2 \pi}\left( \frac{\sqrt{C_{x}^2 \left( x_{j}-x_{k} \right)^2 + C_{y}^2 \left( y_{j}-y_{k} \right)^2 + C_{z}^2 \left( z_{j}-z_{k} \right)^2}}{\frac{U_{j}\left( z_{j} \right)+U_{k}\left( z_{k} \right)}{2}} \right)\right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the coherence value between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{x}&amp;lt;/math&amp;gt;  is the decay coefficient along x,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{y}&amp;lt;/math&amp;gt;  is the decay coefficient along y,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{z}&amp;lt;/math&amp;gt;  is the decay coefficient along z,&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{j}\left( z_{j} \right)&amp;lt;/math&amp;gt;  is the mean wind speed at altitude &amp;lt;math&amp;gt;z_{j}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{k}\left( z_{k} \right)&amp;lt;/math&amp;gt;  is the mean wind speed at altitude &amp;lt;math&amp;gt;z_{k}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ExponentialDecayCx}}: The decay coefficient along x.&lt;br /&gt;
* {{PropertyData|ExponentialDecayCy}}: The decay coefficient along y&lt;br /&gt;
* {{PropertyData|ExponentialDecayCz}}: The decay coefficient along z&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Davenport Coherence Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Coherence Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 coherence = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not coherence:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the coherence function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 coherence.ExponentialDecayCx = 10.0&lt;br /&gt;
 coherence.ExponentialDecayCy = 7.0&lt;br /&gt;
 coherence.ExponentialDecayCz = 6.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, coherence function can vary with time. In case the user desires a time dependent coherence function,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # coherence function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 coherences = sim.computeCrossCoherenceMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(coherences)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Krenk Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
Documentation coming soon.&lt;br /&gt;
&lt;br /&gt;
== Davenport Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Davenport spectrum is widely used in wind engineering to model the [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] of wind velocity in its main direction. The Davenport Power Spectrum or Davenport Wind Spectrum, can be mathematically expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(n)}{u_{*}^2} = k\frac{x^2}{\left(1 + x^2 \right)^{4/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;x = \frac{1200n}{U_{10}}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;  is the von Karman constant which is equal to 4.0,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{10}&amp;lt;/math&amp;gt; is the mean wind speed at height of 10 meters.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MeanWindSpeed10}}: The mean wind speed at height of 10 meters&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Davenport Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.MeanWindSpeed10= &#039;30.0 m/s&#039;&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Harris Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Harris spectrum is widely used in wind engineering to model the [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] of wind velocity in its main direction. The Harris Power Spectrum or Harris Wind Spectrum, can be mathematically expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(n)}{u_{*}^2} = k\frac{x^2}{\left(2 + x^2 \right)^{5/6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;x = \frac{1800n}{U_{10}}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;  is the von Karman constant which is equal to 4.0,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{10}&amp;lt;/math&amp;gt; is the mean wind speed at height of 10 meters.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MeanWindSpeed10}}: The mean wind speed at height of 10 meters&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Harris Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.MeanWindSpeed10= &#039;30.0 m/s&#039;&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{200f}{\left(1 + 50f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 200.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 50.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 200.0&lt;br /&gt;
 spectrum.Constant2 = 50.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Across Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Across_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal across wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{15f}{\left(1 + 9.5f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 15.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 9.5 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Across Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Across Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 15.0&lt;br /&gt;
 spectrum.Constant2 = 9.5&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeYCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Vertical Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Vertical_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal vertical spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{3.36f}{1 + 10f^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 3.36 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 10.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 3.36&lt;br /&gt;
 spectrum.Constant2 = 10.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeZCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{105f}{\left(1 + 33f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 105.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 33.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 105.0&lt;br /&gt;
 spectrum.Constant2 = 33.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Across Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Across_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu across wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{17f}{\left(1 + 9.5f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 17.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 9.5 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Across Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Across Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 17.0&lt;br /&gt;
 spectrum.Constant2 = 9.5&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeYCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Vertical Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Vertical_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu vertical spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{2f}{1 + 5.3f^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 2 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 5.3 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 2&lt;br /&gt;
 spectrum.Constant2 = 5.3&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeZCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== von Karman Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The von Karman Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The von Karman model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the von Karman along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{\sigma_{u}^2} = \frac{4f}{\left(1 + 70.8f^2 \right)^{5/6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nL_u}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\sigma_{u}&amp;lt;/math&amp;gt;  is the standard  deviation,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|StandardDeviation}}: The standard  deviation&lt;br /&gt;
* {{PropertyData|IntegralLengthScale}}: The integral length scale&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 4.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 70.8.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;von Karman Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.StandardDeviation = &#039;1 m/s&#039;&lt;br /&gt;
 spectrum.IntegralLengthScale = &#039;80 m&#039;&lt;br /&gt;
 spectrum.Constant1 = 4.0&lt;br /&gt;
 spectrum.Constant2 = 70.8.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random wind velocity, one common technique is to represent the wind velocity as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== George Deodatis Simulation Method 1996 ==&lt;br /&gt;
&lt;br /&gt;
The paper &amp;quot;Simulation of Ergodic Multivariate Stochastic Processes&amp;quot; by G. Deodatis (1996) presents a method for simulating multivariate stochastic processes, particularly focusing on ergodic processes. The goal of the paper is to provide an efficient method to simulate multivariate stochastic processes that are ergodic. Ergodic processes are those where time averages of the process can be taken as realizations of the ensemble averages. The method is applicable to a wide range of stochastic processes, particularly those in engineering and environmental sciences (e.g., wind, seismic activity, or oceanography).&lt;br /&gt;
According to the method, the stochastic process &amp;lt;math&amp;gt;f_{j}(t) (j = 1, 2, 3, ..., n)&amp;lt;/math&amp;gt; can be simulated by the following series as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f_{j}(t) = 2\sum_{m=1}^{n}\sum_{l=1}^{N}|H_{jm}(\omega_{ml})|\sqrt{\Delta\omega}\cos\left[\omega_{ml}t+\theta_{jm}(\omega_{ml})+\Phi_{ml}\right];\quad j = 1, 2, 3, ..., n;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;S(\omega) = H(\omega)H^{T*}(\omega)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\theta_{jm}(\omega_{ml}) = tan^{-1}\left(\frac{Im[H_{jm}(\omega_{ml})]}{Re[H_{jm}(\omega_{ml})]}\right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f_{j}(t)&amp;lt;/math&amp;gt; is the wind velocity at time instant &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and location &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
* &amp;lt;math&amp;gt;\Phi_{ml}&amp;lt;/math&amp;gt; are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences of independent random phase angles distributed uniformly over the interval &amp;lt;math&amp;gt;\left [ 0,2\pi \right ]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Refer to the paper for more details. Not that, in LabRPS this feature depends on some other features such as location distribution, mean wind profile, power spectral density, coherence function among others. These dependent features must me be created first. You can run the feature any time and follow the error messages to identify the missing feature that you need to create. You can also refer to the script below to identify all required features. In case you want to obtain the results as presented in the paper, you need to used all the parameters as presented in the paper.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Randomness| randomness provider feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import LabRPS&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import time &lt;br /&gt;
&lt;br /&gt;
def simulate():&lt;br /&gt;
    # Plugin&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
    if not installResuslt:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The installation the WindLabPlugin has failed.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # Document&lt;br /&gt;
    doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # Simulation&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    # set simulation parameters&lt;br /&gt;
    sim.NumberOfFrequency = 2048&lt;br /&gt;
    sim.MaxFrequency = &amp;quot;0.64 Hz&amp;quot; # 4 rad/s;&lt;br /&gt;
    sim.FrequencyIncrement = &amp;quot;0.00031 Hz&amp;quot; # 0.00195 rad/s;&lt;br /&gt;
    sim.TimeIncrement = &amp;quot;0.785 s&amp;quot;&lt;br /&gt;
    sim.NumberOfTimeIncrements = 9651&lt;br /&gt;
&lt;br /&gt;
    # Simulation points&lt;br /&gt;
    loc = WindLabObjects.makeFeature(&amp;quot;SimulationPoints&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;General Distribution&amp;quot;, &amp;quot;Location Distribution&amp;quot;)&lt;br /&gt;
    if not loc:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the location distribution.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    v1 = vec(0, 0, 35)&lt;br /&gt;
    v2 = vec(0, 0, 40)&lt;br /&gt;
    v3 = vec(0, 0, 140)&lt;br /&gt;
    loc.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # Mean wind Profile&lt;br /&gt;
    mean = WindLabObjects.makeFeature(&amp;quot;MeanSpeed&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Logarithmic Law Profile&amp;quot;, &amp;quot;Mean Wind Profile&amp;quot;)&lt;br /&gt;
    if not mean:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the mean wind profile was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    mean.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
    mean.ShearVelocity = &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
    # Frequencies&lt;br /&gt;
    frequency = WindLabObjects.makeFeature(&amp;quot;Frequencies&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Double Index Frequency Discretization&amp;quot;, &amp;quot;Frequency Distribution&amp;quot;)   &lt;br /&gt;
    if not frequency:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency distribution.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # Spectrum&lt;br /&gt;
    spectrum = WindLabObjects.makeFeature(&amp;quot;Spectrum&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Kaimal Along Wind Spectrum&amp;quot;, &amp;quot;Along Wind Spectrum&amp;quot;)&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum model.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Coherence&lt;br /&gt;
    coherence = WindLabObjects.makeFeature(&amp;quot;CoherenceFunction&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Davenport Coherence Function&amp;quot;, &amp;quot;Coherence Function&amp;quot;)&lt;br /&gt;
    if not coherence:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the coherence was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    coherence.ExponentialDecayCz = 10 &lt;br /&gt;
&lt;br /&gt;
    # Spectrum decomposition&lt;br /&gt;
    spectrumD = WindLabObjects.makeFeature(&amp;quot;SpectrumDecomposition&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Cholesky Decomposition&amp;quot;, &amp;quot;Spectrum Decomposition Method&amp;quot;)&lt;br /&gt;
    if not spectrumD:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Random phase&lt;br /&gt;
    randomness = WindLabObjects.makeFeature(&amp;quot;RandomPhases&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Uniform Random Phases&amp;quot;, &amp;quot;Randomness Provider&amp;quot;)&lt;br /&gt;
    if not randomness:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the randomness provider was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # Simulation method&lt;br /&gt;
    simMethod = WindLabObjects.makeFeature(&amp;quot;SimulationMethod&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Deodatis 1996&amp;quot;, &amp;quot;Simulation Method&amp;quot;)&lt;br /&gt;
    if not simMethod:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation method.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Run simulation and output the first(0) sample&lt;br /&gt;
    # store starting time &lt;br /&gt;
    begin = time.time() &lt;br /&gt;
    velocities = sim.simulate(0)&lt;br /&gt;
    # store end time &lt;br /&gt;
    end = time.time()&lt;br /&gt;
    LabRPS.Console.PrintMessage(f&amp;quot;Total runtime of the simulaltion is {end - begin} seconds\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    if LabRPS.GuiUp:&lt;br /&gt;
       import WindLabGui&lt;br /&gt;
       import GeneralToolsGui&lt;br /&gt;
       WindLabGui.setActiveSimulation(sim)&lt;br /&gt;
       GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfTimeIncrements, sim.getSimulationData().numberOfSpatialPosition + 1, velocities, True)&lt;br /&gt;
&lt;br /&gt;
simulate()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, WindLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If WindLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Wave Passage effect ==&lt;br /&gt;
&lt;br /&gt;
The wave passage effect is a measure of the wave passage delay due to the apparent velocity of waves, which is one of spatially varying properties of multivariate random processes. The exponential Wave Passage effect is expressed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = \mbox{exp}\left ( -i\frac{\omega \times \xi_{jk}}{v_{app}} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the wave passage effect between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\xi_{jk}&amp;lt;/math&amp;gt; is the distance between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ApparentWaveVelocity}}: The apparent wave velocity.&lt;br /&gt;
* {{PropertyData|Coefficient}}: The appropriate coefficient that can obtained from experiments.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Exponential Wave Passage Effect&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Wave Passage Effect&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set simulation parameters&lt;br /&gt;
    sim.NumberOfFrequency = 2048&lt;br /&gt;
    sim.MaxFrequency = &amp;quot;0.64 Hz&amp;quot; # 4 rad/s;&lt;br /&gt;
    sim.FrequencyIncrement = &amp;quot;0.00031 Hz&amp;quot; # 0.00195 rad/s;&lt;br /&gt;
     &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to compute the wave passage effect which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active wave passage effect in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the wave passage effect between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, WindLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active wave passage effect feature, and others. If WindLab fails to find any of these dependency features, &lt;br /&gt;
    # the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    effect13 = sim.computeWavePassageEffectVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(effect13), len(effect13[0]), effect13)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_WindLab&amp;diff=2678</id>
		<title>Plugin WindLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_WindLab&amp;diff=2678"/>
		<updated>2025-02-09T19:11:20Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=WindLab Plugin&lt;br /&gt;
|Description=This plugin implement various WindLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Power_Law_Profile|Power Law Profile]], [[#Logarithmic_Law_Profile|Logarithmic Law Profile]], [[#Deaves_and_Harris_Profile|Deaves and Harris Profile]], [[#Sine_Modulation_Function|Sine Modulation Function]], [[#Three_Parameter_Modulation_Function|Three Parameter Modulation Function]], [[#Exponential_Modulation_Function|Exponential Modulation Function]], [[#Davenport_Coherence_Function|Davenport Coherence Function]], [[#Krenk_Coherence_Function|Krenk Coherence Function]], [[#Davenport_Along_Wind_Spectrum|Davenport Along Wind Spectrum]], [[#Harris_Along_Wind_Spectrum|Harris Along Wind Spectrum]], [[#Kaimal_Along_Wind_Spectrum|Kaimal Along Wind Spectrum]], [[#Kaimal_Across_Wind_Spectrum|Kaimal Across Wind Spectrum]], [[#Kaimal_Vertical_Wind_Spectrum|Kaimal Vertical Wind Spectrum]], [[#Simiu_Along_Wind_Spectrum|Simiu Along Wind Spectrum]], [[#Simiu_Across_Wind_Spectrum|Simiu Across Wind Spectrum]], [[#Simiu_Vertical_Wind_Spectrum|Simiu Vertical Wind Spectrum]], [[#von_Karman_Along_Wind_Spectrum|von Karman Along Wind Spectrum]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#George_Deodatis_Simulation_Method_1996|George Deodatis Simulation Method(1996)]], [[#Cholesky_Decomposition|Cholesky Decomposition]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/WindLab/WindLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random wind velocity. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random wind simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random wind simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:WindLab_Tutorial001_Pic005_WindLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:WindLab_Tutorial001_Pic006_WindLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. WindLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Power Law Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the power law mean wind profile, which is commonly used to model the variation of wind speed with height in the atmospheric boundary layer. This model is essential in fields such as wind energy, structural engineering, and environmental science. The power law formula that governs the relationship between wind speed and height is expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) = U(z_0)\times\left( \frac{{z-\phi}}{z_0} \right)^\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z_0)&amp;lt;/math&amp;gt; is the reference wind speed at a known reference height &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is the power law exponent, a dimensionless constant that varies depending on terrain and atmospheric conditions,&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ReferenceHeight}}: This is a reference height.&lt;br /&gt;
* {{PropertyData|ReferenceSpeed}}: This is the reference wind speed at the reference height.&lt;br /&gt;
* {{PropertyData|DimensionlessPower}}: This is the power law exponent.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: This is the zero plan displacement.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       # abord the computation &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Power Law Profile&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not meanSpeed:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       # abord the computation&lt;br /&gt;
&lt;br /&gt;
    meanSpeed.ReferenceHeight = &#039;10.00 m&#039;&lt;br /&gt;
    meanSpeed.ReferenceSpeed = &#039;30.00 m/s&#039;&lt;br /&gt;
    meanSpeed.DimensionlessPower = 0.12&lt;br /&gt;
    meanSpeed.ZeroPlanDisplacement = &#039;0.0 m&#039;&lt;br /&gt;
&lt;br /&gt;
    # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
    # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
    # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
    # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
    # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
    # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
    # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 2, meanValues, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Logarithmic Law Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the logarithmic law mean wind profile. The logarithmic law is commonly used to model the variation of wind speed with height in the atmospheric boundary layer, especially in cases where the wind profile is influenced by surface roughness, such as over flat terrain, forests, or urban environments. The logarithmic law for wind speed variation is given by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) =\left( \frac{u_*}{k} \right)\times\ln{\left( \frac{{z-\phi}}{z_0} \right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_*&amp;lt;/math&amp;gt;  is the friction velocity, which is a measure of the turbulence intensity,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is the von Kármán constant (approximately 0.4),&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt; is the roughness length, which characterizes the roughness of the surface,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TerrainRoughness}}: This is the terrain roughness value.&lt;br /&gt;
* {{PropertyData|ShearVelocity}}: This is the shear velocity of the flow.&lt;br /&gt;
* {{PropertyData|vonKarmanConstant}}: This is the von karman constant.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: This is the zero plan displacement value.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Logarithmic Law Profile&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not meanSpeed:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 meanSpeed.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
 meanSpeed.ShearVelocity = &#039;1.76 m/s&#039; &lt;br /&gt;
&lt;br /&gt;
 # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
&lt;br /&gt;
 # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Deaves and Harris Profile ==&lt;br /&gt;
&lt;br /&gt;
This feature is designed to compute the wind speed at a given height based on the logarithmic law mean wind profile. The logarithmic law is commonly used to model the variation of wind speed with height in the atmospheric boundary layer, especially in cases where the wind profile is influenced by surface roughness, such as over flat terrain, forests, or urban environments. The logarithmic law for wind speed variation is given by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U(z) =\left( \frac{u_*}{k} \right)\times\left [\ln{\left( \frac{{z-z_d}}{z_0} \right)} + 5.75\left( \frac{{z-z_d}}{h} \right) - 1.88\left( \frac{{z-z_d}}{h} \right)^2 - 1.33\left( \frac{{z-z_d}}{h} \right)^3 + 0.25\left( \frac{{z-z_d}}{h} \right)^4\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_*&amp;lt;/math&amp;gt;  is the friction velocity, which is a measure of the turbulence intensity,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is the von Kármán constant (approximately 0.4),&lt;br /&gt;
* &amp;lt;math&amp;gt;z_d&amp;lt;/math&amp;gt; is the zero plan displacement,&lt;br /&gt;
* &amp;lt;math&amp;gt;z_0&amp;lt;/math&amp;gt; is the roughness length, which characterizes the roughness of the surface,&lt;br /&gt;
* &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is the gradient height, deﬁned as the height where atmospheric ﬂow is free from surface stresses and becomes geostrophic,&lt;br /&gt;
* &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; is the height at which the wind speed is to be calculated.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TerrainRoughness}}: The terrain roughness length.&lt;br /&gt;
* {{PropertyData|ShearVelocity}}: The shear velocity of the flow.&lt;br /&gt;
* {{PropertyData|ZeroPlanDisplacement}}: The zero plan displacement.&lt;br /&gt;
* {{PropertyData|Latitude}}: The latitude.&lt;br /&gt;
* {{PropertyData|EarthAngularVelocity}}: The earth angular velocity.&lt;br /&gt;
* {{PropertyData|Betta}}: The coefficient beta.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Deaves and Harris Profile&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Mean Wind Profile&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 meanSpeed= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not meanSpeed:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 meanSpeed.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
 meanSpeed.ShearVelocity = &#039;1.76 m/s&#039; &lt;br /&gt;
&lt;br /&gt;
 # In WindLab, mean wind velocity can vary with time. In case the user desires a time dependent mean wind speed,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # mean wind speed. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
&lt;br /&gt;
 # compute the mean wind speeds at time instant of 0 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 meanValues = sim.computeMeanWindSpeedVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(meanValues )&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Sine Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as a sine wave, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = sin\left( \frac{\pi\times t}{T} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;  is the pulse duration,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Randomness| randomness provider feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PulseDuration}}: The pusle duration.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Sine Wave Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.PulseDuration= &#039;150 m/s&#039;&lt;br /&gt;
 &lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Three Parameter Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as an exponential function, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = \alpha t^\beta e^{-\lambda t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;  is the alpha coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;\beta &amp;lt;/math&amp;gt;  is the beta coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;\lambda &amp;lt;/math&amp;gt;  is the lambda coefficient,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Alpha}}: The alpha coefficient.&lt;br /&gt;
* {{PropertyData|Betta}}: The beta coefficient.&lt;br /&gt;
* {{PropertyData|Lambda}}: The lambda coefficient.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Three Parameter Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.Alpha = 4.98&lt;br /&gt;
 modulation.Betta = 3.00&lt;br /&gt;
 modulation.Lambda = 0.003&lt;br /&gt;
&lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Modulation Function ==&lt;br /&gt;
&lt;br /&gt;
This feature represents a uniform modulation function used to achieve stationarity in the simulation of random wind velocity. Uniformity here means the modulation function is not function of frequency. It is modeled as an exponential function, described by the following equation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A(t) = exp\left[-\frac{1}{2}\left( \frac{t-t_{m} }{t_{l}} \right)^2\right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;A(t)&amp;lt;/math&amp;gt; is the modulation function value at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;t_{m}&amp;lt;/math&amp;gt;  is the time when the modulation function reaches its maximum,&lt;br /&gt;
* &amp;lt;math&amp;gt;t_{l}&amp;lt;/math&amp;gt;  is the storm length,&lt;br /&gt;
* &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is the time at which the modulation function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TimeOfMax}}: The time when the modulation function reaches its maximum.&lt;br /&gt;
* {{PropertyData|StormLength}}: The storm length.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Exponential Modulation Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Uniform Modulation Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 modulation= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not modulation:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the modulation function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 modulation.TimeOfMax = &#039;300 s&#039;&lt;br /&gt;
 modulation.StormLength = &#039;60 s&#039;&lt;br /&gt;
&lt;br /&gt;
 # set a time instant of 2 seconds&lt;br /&gt;
 time = 2&lt;br /&gt;
&lt;br /&gt;
 # compute the modulation value at time instant of 2 second and for all simulation points&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # If WindLab fails to find this dependency feature, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 modulations= sim.computeModulationVectorP(time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(modulations)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Davenport Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this feature is to model the spatial correlation of wind velocities, which is crucial in many engineering applications, especially in the context of wind turbine design, structural analysis, and environmental studies. The Davenport Coherence Function quantifies the correlation between the wind velocity at two points, in space (at different locations). It is derived from the theory of wind turbulence and helps in simulating the correlated behavior of wind speeds over a geographical area. The mathematical form of the Davenport Coherence Function, for two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; is expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = exp\left[-\frac{\omega}{2 \pi}\left( \frac{\sqrt{C_{x}^2 \left( x_{j}-x_{k} \right)^2 + C_{y}^2 \left( y_{j}-y_{k} \right)^2 + C_{z}^2 \left( z_{j}-z_{k} \right)^2}}{\frac{U_{j}\left( z_{j} \right)+U_{k}\left( z_{k} \right)}{2}} \right)\right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the coherence value between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{x}&amp;lt;/math&amp;gt;  is the decay coefficient along x,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{y}&amp;lt;/math&amp;gt;  is the decay coefficient along y,&lt;br /&gt;
* &amp;lt;math&amp;gt;C_{z}&amp;lt;/math&amp;gt;  is the decay coefficient along z,&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{j}\left( z_{j} \right)&amp;lt;/math&amp;gt;  is the mean wind speed at altitude &amp;lt;math&amp;gt;z_{j}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{k}\left( z_{k} \right)&amp;lt;/math&amp;gt;  is the mean wind speed at altitude &amp;lt;math&amp;gt;z_{k}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ExponentialDecayCx}}: The decay coefficient along x.&lt;br /&gt;
* {{PropertyData|ExponentialDecayCy}}: The decay coefficient along y&lt;br /&gt;
* {{PropertyData|ExponentialDecayCz}}: The decay coefficient along z&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Davenport Coherence Function&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Coherence Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 coherence = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not coherence:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the coherence function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 coherence.ExponentialDecayCx = 10.0&lt;br /&gt;
 coherence.ExponentialDecayCy = 7.0&lt;br /&gt;
 coherence.ExponentialDecayCz = 6.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, coherence function can vary with time. In case the user desires a time dependent coherence function,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # coherence function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 coherences = sim.computeCrossCoherenceMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(coherences)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Krenk Coherence Function ==&lt;br /&gt;
&lt;br /&gt;
Documentation coming soon.&lt;br /&gt;
&lt;br /&gt;
== Davenport Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Davenport spectrum is widely used in wind engineering to model the [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] of wind velocity in its main direction. The Davenport Power Spectrum or Davenport Wind Spectrum, can be mathematically expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(n)}{u_{*}^2} = k\frac{x^2}{\left(1 + x^2 \right)^{4/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;x = \frac{1200n}{U_{10}}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;  is the von Karman constant which is equal to 4.0,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{10}&amp;lt;/math&amp;gt; is the mean wind speed at height of 10 meters.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MeanWindSpeed10}}: The mean wind speed at height of 10 meters&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Davenport Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.MeanWindSpeed10= &#039;30.0 m/s&#039;&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Harris Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Harris spectrum is widely used in wind engineering to model the [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] of wind velocity in its main direction. The Harris Power Spectrum or Harris Wind Spectrum, can be mathematically expressed as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(n)}{u_{*}^2} = k\frac{x^2}{\left(2 + x^2 \right)^{5/6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;x = \frac{1800n}{U_{10}}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;  is the von Karman constant which is equal to 4.0,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U_{10}&amp;lt;/math&amp;gt; is the mean wind speed at height of 10 meters.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MeanWindSpeed10}}: The mean wind speed at height of 10 meters&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Harris Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.MeanWindSpeed10= &#039;30.0 m/s&#039;&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{200f}{\left(1 + 50f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 200.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 50.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 200.0&lt;br /&gt;
 spectrum.Constant2 = 50.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Across Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Across_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal across wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{15f}{\left(1 + 9.5f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 15.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 9.5 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Across Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Across Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 15.0&lt;br /&gt;
 spectrum.Constant2 = 9.5&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeYCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Kaimal Vertical Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Kaimal Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Kaimal model provides a [[WindLab_Feature#Vertical_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Kaimal vertical spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{3.36f}{1 + 10f^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 3.36 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 10.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Kaimal Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 3.36&lt;br /&gt;
 spectrum.Constant2 = 10.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeZCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{105f}{\left(1 + 33f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 105.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 33.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 105.0&lt;br /&gt;
 spectrum.Constant2 = 33.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Across Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Across_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu across wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{17f}{\left(1 + 9.5f \right)^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 17.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 9.5 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Across Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Across Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 17.0&lt;br /&gt;
 spectrum.Constant2 = 9.5&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeYCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Simiu Vertical Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Simiu Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The Simiu model provides a [[WindLab_Feature#Vertical_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the Simiu vertical spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{u_{*}^2} = \frac{2f}{1 + 5.3f^{5/3}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nz}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;u_{*}&amp;lt;/math&amp;gt;  is the shear velocity of the flow,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|shearVelocity}}: The shear velocity of the flow&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 2 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 5.3 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Simiu Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Vertical Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.shearVelocity= &#039;1.76 m/s&#039;&lt;br /&gt;
 spectrum.Constant1 = 2&lt;br /&gt;
 spectrum.Constant2 = 5.3&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeZCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== von Karman Along Wind Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The von Karman Spectrum is a frequency-domain model that describes the distribution of energy in turbulent wind velocity across different frequencies. It is specifically designed for modeling atmospheric turbulence. The von Karman model provides a [[WindLab_Feature#Along_Wind_Spectrum|power spectral density (PSD)]] function that approximates the energy contained in the wind velocity as a function of frequency. Mathematically, the von Karman along wind spectrum is given by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{nS(z,n)}{\sigma_{u}^2} = \frac{4f}{\left(1 + 70.8f^2 \right)^{5/6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;f = \frac{nL_u}{U(z)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;S(z,n)&amp;lt;/math&amp;gt; is the power spectral density value for frequency value &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\sigma_{u}&amp;lt;/math&amp;gt;  is the standard  deviation,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the frequency for which the power spectral density is computed.&lt;br /&gt;
* &amp;lt;math&amp;gt;U(z)&amp;lt;/math&amp;gt; is the mean wind speed at height &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|StandardDeviation}}: The standard  deviation&lt;br /&gt;
* {{PropertyData|IntegralLengthScale}}: The integral length scale&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant equal to 4.0 by default&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant equal to 70.8.0 by default&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;von Karman Along Wind Spectrum&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Along Wind Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 spectrum= WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not spectrum:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 spectrum.StandardDeviation = &#039;1 m/s&#039;&lt;br /&gt;
 spectrum.IntegralLengthScale = &#039;80 m&#039;&lt;br /&gt;
 spectrum.Constant1 = 4.0&lt;br /&gt;
 spectrum.Constant2 = 70.8.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, power spectral density function can vary with time. In case the user desires a time dependent spectrum function,  &lt;br /&gt;
 # a modulation function can be used for this purpose if the feature is stationary and allows uniform modulation. &lt;br /&gt;
 # The feature account for this. When the Stationarity property of the parent simulation of this feature is false, &lt;br /&gt;
 # the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # spectrum function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 spectrumMatrix = sim.computeXCrossSpectrumMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(spectrumMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random wind velocity, one common technique is to represent the wind velocity as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== George Deodatis Simulation Method 1996 ==&lt;br /&gt;
&lt;br /&gt;
The paper &amp;quot;Simulation of Ergodic Multivariate Stochastic Processes&amp;quot; by G. Deodatis (1996) presents a method for simulating multivariate stochastic processes, particularly focusing on ergodic processes. The goal of the paper is to provide an efficient method to simulate multivariate stochastic processes that are ergodic. Ergodic processes are those where time averages of the process can be taken as realizations of the ensemble averages. The method is applicable to a wide range of stochastic processes, particularly those in engineering and environmental sciences (e.g., wind, seismic activity, or oceanography).&lt;br /&gt;
According to the method, the stochastic process &amp;lt;math&amp;gt;f_{j}(t) (j = 1, 2, 3, ..., n)&amp;lt;/math&amp;gt; can be simulated by the following series as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f_{j}(t) = 2\sum_{m=1}^{n}\sum_{l=1}^{N}|H_{jm}(\omega_{ml})|\sqrt{\Delta\omega}\cos\left[\omega_{ml}t+\theta_{jm}(\omega_{ml})+\Phi_{ml}\right];\quad j = 1, 2, 3, ..., n;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;S(\omega) = H(\omega)H^{T*}(\omega)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\theta_{jm}(\omega_{ml}) = tan^{-1}\left(\frac{Im[H_{jm}(\omega_{ml})]}{Re[H_{jm}(\omega_{ml})]}\right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f_{j}(t)&amp;lt;/math&amp;gt; is the wind velocity at time instant &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and location &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
* &amp;lt;math&amp;gt;\Phi_{ml}&amp;lt;/math&amp;gt; are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences of independent random phase angles distributed uniformly over the interval &amp;lt;math&amp;gt;\left [ 0,2\pi \right ]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Refer to the paper for more details. Not that, in LabRPS this feature depends on some other features such as location distribution, mean wind profile, power spectral density, coherence function among others. These dependent features must me be created first. You can run the feature any time and follow the error messages to identify the missing feature that you need to create. You can also refer to the script below to identify all required features. In case you want to obtain the results as presented in the paper, you need to used all the parameters as presented in the paper.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[WindLab_Feature#Mean_Wind_Speed_Profile| mean wind speed profile feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Randomness| randomness provider feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import LabRPS&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import time &lt;br /&gt;
&lt;br /&gt;
def simulate():&lt;br /&gt;
    # Plugin&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
    if not installResuslt:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The installation the WindLabPlugin has failed.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # Document&lt;br /&gt;
    doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # Simulation&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    # set simulation parameters&lt;br /&gt;
    sim.NumberOfFrequency = 2048&lt;br /&gt;
    sim.MaxFrequency = &amp;quot;0.64 Hz&amp;quot; # 4 rad/s;&lt;br /&gt;
    sim.FrequencyIncrement = &amp;quot;0.00031 Hz&amp;quot; # 0.00195 rad/s;&lt;br /&gt;
    sim.TimeIncrement = &amp;quot;0.785 s&amp;quot;&lt;br /&gt;
    sim.NumberOfTimeIncrements = 9651&lt;br /&gt;
&lt;br /&gt;
    # Simulation points&lt;br /&gt;
    loc = WindLabObjects.makeFeature(&amp;quot;SimulationPoints&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;General Distribution&amp;quot;, &amp;quot;Location Distribution&amp;quot;)&lt;br /&gt;
    if not loc:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the location distribution.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    v1 = vec(0, 0, 35)&lt;br /&gt;
    v2 = vec(0, 0, 40)&lt;br /&gt;
    v3 = vec(0, 0, 140)&lt;br /&gt;
    loc.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # Mean wind Profile&lt;br /&gt;
    mean = WindLabObjects.makeFeature(&amp;quot;MeanSpeed&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Logarithmic Law Profile&amp;quot;, &amp;quot;Mean Wind Profile&amp;quot;)&lt;br /&gt;
    if not mean:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the mean wind profile was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    mean.TerrainRoughness = &#039;0.001266 m&#039; &lt;br /&gt;
    mean.ShearVelocity = &#039;1.76 m/s&#039;&lt;br /&gt;
&lt;br /&gt;
    # Frequencies&lt;br /&gt;
    frequency = WindLabObjects.makeFeature(&amp;quot;Frequencies&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Double Index Frequency Discretization&amp;quot;, &amp;quot;Frequency Distribution&amp;quot;)   &lt;br /&gt;
    if not frequency:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency distribution.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # Spectrum&lt;br /&gt;
    spectrum = WindLabObjects.makeFeature(&amp;quot;Spectrum&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Kaimal Along Wind Spectrum&amp;quot;, &amp;quot;Along Wind Spectrum&amp;quot;)&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum model.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Coherence&lt;br /&gt;
    coherence = WindLabObjects.makeFeature(&amp;quot;CoherenceFunction&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Davenport Coherence Function&amp;quot;, &amp;quot;Coherence Function&amp;quot;)&lt;br /&gt;
    if not coherence:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the coherence was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    coherence.ExponentialDecayCz = 10 &lt;br /&gt;
&lt;br /&gt;
    # Spectrum decomposition&lt;br /&gt;
    spectrumD = WindLabObjects.makeFeature(&amp;quot;SpectrumDecomposition&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Cholesky Decomposition&amp;quot;, &amp;quot;Spectrum Decomposition Method&amp;quot;)&lt;br /&gt;
    if not spectrumD:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Random phase&lt;br /&gt;
    randomness = WindLabObjects.makeFeature(&amp;quot;RandomPhases&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Uniform Random Phases&amp;quot;, &amp;quot;Randomness Provider&amp;quot;)&lt;br /&gt;
    if not randomness:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The creation of the randomness provider was not successuful.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # Simulation method&lt;br /&gt;
    simMethod = WindLabObjects.makeFeature(&amp;quot;SimulationMethod&amp;quot;, &amp;quot;Simulation&amp;quot;,  &amp;quot;Deodatis 1996&amp;quot;, &amp;quot;Simulation Method&amp;quot;)&lt;br /&gt;
    if not simMethod:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation method.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
    &lt;br /&gt;
    # Run simulation and output the first(0) sample&lt;br /&gt;
    # store starting time &lt;br /&gt;
    begin = time.time() &lt;br /&gt;
    velocities = sim.simulate(0)&lt;br /&gt;
    # store end time &lt;br /&gt;
    end = time.time()&lt;br /&gt;
    LabRPS.Console.PrintMessage(f&amp;quot;Total runtime of the simulaltion is {end - begin} seconds\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    if LabRPS.GuiUp:&lt;br /&gt;
       import WindLabGui&lt;br /&gt;
       import GeneralToolsGui&lt;br /&gt;
       WindLabGui.setActiveSimulation(sim)&lt;br /&gt;
       GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfTimeIncrements, sim.getSimulationData().numberOfSpatialPosition + 1, velocities, True)&lt;br /&gt;
&lt;br /&gt;
simulate()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* An [[WindLab_Feature#Along_Wind_Spectrum| along wind spectrum feature]] or an [[WindLab_Feature#Across_Wind_Spectrum| across wind spectrum feature]] or a [[WindLab_Feature#Vertical_Wind_Spectrum| vertical wind spectrum feature]] depending on your wind velocity component.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = WindLab.installPlugin(&amp;quot;WindLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = WindLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, WindLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If WindLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Exponential Wave Passage effect ==&lt;br /&gt;
&lt;br /&gt;
The wave passage effect is a measure of the wave passage delay due to the apparent velocity of waves, which is one of spatially varying properties of multivariate random processes. The exponential Wave Passage effect is expressed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma_{jk}(\omega) = \mbox{exp}\left ( -i\frac{\omega \xi_{jk}}{v_{app}} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\gamma_{jk}(\omega)&amp;lt;/math&amp;gt; is the wave passage effect between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt; at frequency &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\xi_{jk}&amp;lt;/math&amp;gt; is the distance between two points &amp;lt;math&amp;gt;P_{j}\left( x_{j},y_{j},z_{j} \right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_{k}\left( x_{k},y_{k},z_{k} \right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt; is the frequency for which the coherence function is computed.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ApparentWaveVelocity}}: The apparent wave velocity.&lt;br /&gt;
* {{PropertyData|Coefficient}}: The appropriate coefficient that can obtained from experiments.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import WindLab&lt;br /&gt;
import WindLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing WindLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = WindLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Exponential Wave Passage effect&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Wave Passage effect&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the WindLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 coherence = WindLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not coherence:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the coherence function feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 coherence.ExponentialDecayCx = 10.0&lt;br /&gt;
 coherence.ExponentialDecayCy = 7.0&lt;br /&gt;
 coherence.ExponentialDecayCz = 6.0&lt;br /&gt;
&lt;br /&gt;
 # In WindLab, coherence function can vary with time. In case the user desires a time dependent coherence function,  &lt;br /&gt;
 # a modulation function can be used for this purpose. The feature account for this. When the Stationarity property of the parent &lt;br /&gt;
 # simulation of this feature is false, the feature identify the active modulation function and use it to produce non-stationary &lt;br /&gt;
 # coherence function by transforming the the mean wind speeds into time dependent mean wind speeds. But for this example we shall use time instant of 0 second.&lt;br /&gt;
 time = 0.0&lt;br /&gt;
 frequency = 0.25&lt;br /&gt;
&lt;br /&gt;
 # compute the coherence matrix at time instant of 0 second and frequency of 0.24 rad/s&lt;br /&gt;
 # Note that when the following code is run, WindLab will try to identify the active locations distribution,&lt;br /&gt;
 # it will also try to identity the active modulation function in case the parent simulation is non-stationary. &lt;br /&gt;
 # If WindLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
 coherences = sim.computeCrossCoherenceMatrixPP(frequency, time)&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(coherences)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2677</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2677"/>
		<updated>2025-02-09T17:46:24Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* General Distribution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Borgman_Directional_Spreading_Function|Borgman Directional Spreading Function]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Mitsuyasu_Directional_Spreading_Function|Mitsuyasu Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:WindLab_Tutorial001_Pic005_WindLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Borgman Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Borgman directional spreading function is based on a circular normal distribution of Mobarek (1965) and Fan (1968):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{1}{2I_0\left ( \theta_p \right )}\mbox{exp}\left [ a\mbox{cos}\left ( \theta - \theta_p \right ) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_0\left ( \theta_p \right )&amp;lt;/math&amp;gt; is the Bessel function of the second kind and zeroth order.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|AngleOfPropagationOfPredominantWaveEnergy}}: The  angle of propagation of predominant wave energy..&lt;br /&gt;
* {{PropertyData|PositiveConstant}} : A positive constant.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Borgman Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2676</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2676"/>
		<updated>2025-02-09T17:43:01Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Borgman_Directional_Spreading_Function|Borgman Directional Spreading Function]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Mitsuyasu_Directional_Spreading_Function|Mitsuyasu Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Borgman Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Borgman directional spreading function is based on a circular normal distribution of Mobarek (1965) and Fan (1968):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{1}{2I_0\left ( \theta_p \right )}\mbox{exp}\left [ a\mbox{cos}\left ( \theta - \theta_p \right ) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_0\left ( \theta_p \right )&amp;lt;/math&amp;gt; is the Bessel function of the second kind and zeroth order.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|AngleOfPropagationOfPredominantWaveEnergy}}: The  angle of propagation of predominant wave energy..&lt;br /&gt;
* {{PropertyData|PositiveConstant}} : A positive constant.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Borgman Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2675</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2675"/>
		<updated>2025-02-09T17:26:10Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Borgman_Directional_Spreading_Function|Borgman Directional Spreading Function]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Mitsuyasu_Directional_Spreading_Function|Mitsuyasu Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Borgman Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Borgman directional spreading function is based on a circular normal distribution of Mobarek (1965) and Fan (1968):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{1}{2I_0\left ( \theta_p \right )}\mbox{exp}\left [ a\mbox{cos}\left ( \theta - \theta_p \right ) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_0\left ( \theta_p \right )&amp;lt;/math&amp;gt; is the Bessel function of the second kind and zeroth order.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|AngleOfPropagationOfPredominantWaveEnergy}}: The  angle of propagation of predominant wave energy..&lt;br /&gt;
* {{PropertyData|PositiveConstant}} : A positive constant.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Borgman Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2674</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2674"/>
		<updated>2025-02-09T17:25:33Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Borgman_Directional_Spreading_Function|Borgman Directional Spreading Function]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Mitsuyasu_Squared_Directional_Spreading_Function|Mitsuyasu Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Borgman Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Borgman directional spreading function is based on a circular normal distribution of Mobarek (1965) and Fan (1968):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{1}{2I_0\left ( \theta_p \right )}\mbox{exp}\left [ a\mbox{cos}\left ( \theta - \theta_p \right ) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_0\left ( \theta_p \right )&amp;lt;/math&amp;gt; is the Bessel function of the second kind and zeroth order.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|AngleOfPropagationOfPredominantWaveEnergy}}: The  angle of propagation of predominant wave energy..&lt;br /&gt;
* {{PropertyData|PositiveConstant}} : A positive constant.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Borgman Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2673</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2673"/>
		<updated>2025-02-09T15:57:27Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Borgman Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Borgman_Directional_Spreading_Function|Borgman Directional Spreading Function]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Borgman Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Borgman directional spreading function is based on a circular normal distribution of Mobarek (1965) and Fan (1968):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{1}{2I_0\left ( \theta_p \right )}\mbox{exp}\left [ a\mbox{cos}\left ( \theta - \theta_p \right ) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_0\left ( \theta_p \right )&amp;lt;/math&amp;gt; is the Bessel function of the second kind and zeroth order.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|AngleOfPropagationOfPredominantWaveEnergy}}: The  angle of propagation of predominant wave energy..&lt;br /&gt;
* {{PropertyData|PositiveConstant}} : A positive constant.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Borgman Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2672</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2672"/>
		<updated>2025-02-09T15:41:47Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Borgman_Directional_Spreading_Function|Borgman Directional Spreading Function]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Borgman Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Borgman directional spreading function is based on a circular normal distribution of Mobarek (1965) and Fan (1968):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{e^{acos(\theta -\theta_0)}}{2I_0(\theta_0)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Borgman Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2671</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2671"/>
		<updated>2025-02-08T22:17:18Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* SWOP Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2670</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2670"/>
		<updated>2025-02-08T22:14:08Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* OrcaFlex Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2669</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2669"/>
		<updated>2025-02-08T20:04:25Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* SWOP Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The SWOP(stereo wave observation project) directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{\pi}\left \{ 1 + \left [ 0.5 +0.82\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ] \right ] \mbox{cos}\left ( 2\theta  \right )+ 0.32\mbox{exp}\left [ \frac{\left ( \omega /\omega_0 \right )^4}{2} \right ]\mbox{cos}\left ( 4\theta  \right )\right \}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_0  = \frac{0.855\times g}{U_{10}}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2668</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2668"/>
		<updated>2025-02-08T19:32:00Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* OrcaFlex Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
K(n) = \dfrac{\Gamma\left(\frac{n}{2}+1\right)}{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac12\right)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The principal wave direction.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} : The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2667</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2667"/>
		<updated>2025-02-08T19:26:55Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]], [[#OrcaFlex_Directional_Spreading_Function|OrcaFlex Directional Spreading Function]], [[#SWOP_Directional_Spreading_Function|SWOP Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== OrcaFlex Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The directional spreading spectrum used by OrcaFlex is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega)&lt;br /&gt;
= K(n)\ \cos^n(\theta-\theta_\mathrm{p}) \quad&lt;br /&gt;
            \text{ for } {-\tfrac\pi2} \leq \theta-\theta_\mathrm{p} \leq \tfrac\pi2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;OrcaFlex Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== SWOP Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;SWOP Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2666</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2666"/>
		<updated>2025-02-08T16:34:01Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Longuet Higgins Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \frac{1}{2\sqrt{\pi}}\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightMeanWindSpeed}} : The mean wind speed at ten meters above ground.&lt;br /&gt;
* {{PropertyData|MainDirection}} : The main propagation direction of the wave.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Longuet-Higgins Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2665</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2665"/>
		<updated>2025-02-08T16:28:47Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]], [[#Longuet_Higgins_Directional_Spreading_Function|Longuet-Higgins Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Longuet Higgins Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Longuet-Higgins directional spreading function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta,\omega) = \left ( \frac{1}{2\sqrt{\pi}} \right )\frac{\Gamma\left ( s+1\right )}{\Gamma\left ( s+1/2\right )}\mbox{cos}^{2s}\left ( \frac{\theta_w -\theta}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s = 11.5\left ( \frac{g}{\omega_pU_{10}} \right )^{2.5}\left ( \frac{\omega}{\omega_p} \right )^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2664</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2664"/>
		<updated>2025-02-08T16:03:13Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
6.97\left ( \frac{\omega}{\omega_m} \right )^{4.06},   &amp;amp; \mbox{for } \omega \le 1.05\omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
9.77\left ( \frac{\omega}{\omega_m} \right )^{\mu},   &amp;amp; \mbox{for } \omega &amp;gt; 1.05\omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = -2.33-1.45\left ( \frac{\omega_mU}{g} -1.17\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)                 &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2663</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2663"/>
		<updated>2025-02-08T14:59:59Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
     &lt;br /&gt;
    spreading.ModalFrequency = &#039;0.004 1/s&#039;&lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.004 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\left ( 9.77 + 0.43 \right )\left ( \frac{\omega}{\omega_m} \right )^{-(2.33+0.06)-(1.45+0.45)(U/c_m-1.17)},   &amp;amp; \mbox{for } \omega \ge \omega_m \mbox{ and } U &amp;gt; c_m\\&lt;br /&gt;
\\&lt;br /&gt;
\left ( 6.97 + 0.83 \right )\left ( \frac{\omega}{\omega_m} \right )^{4.06+0.22},   &amp;amp; \mbox{for } \omega &amp;lt; \omega_m \mbox{ and } U &amp;gt; c_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2662</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2662"/>
		<updated>2025-02-08T02:53:54Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Mitsuyasu Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|TenMeterHeightmeanWindSpeed}} : The mean wind speed at 10 meters above aground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\left ( 9.77 + 0.43 \right )\left ( \frac{\omega}{\omega_m} \right )^{-(2.33+0.06)-(1.45+0.45)(U/c_m-1.17)},   &amp;amp; \mbox{for } \omega \ge \omega_m \mbox{ and } U &amp;gt; c_m\\&lt;br /&gt;
\\&lt;br /&gt;
\left ( 6.97 + 0.83 \right )\left ( \frac{\omega}{\omega_m} \right )^{4.06+0.22},   &amp;amp; \mbox{for } \omega &amp;lt; \omega_m \mbox{ and } U &amp;gt; c_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2661</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2661"/>
		<updated>2025-02-08T02:51:27Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Hasselmann Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\left ( 9.77 + 0.43 \right )\left ( \frac{\omega}{\omega_m} \right )^{-(2.33+0.06)-(1.45+0.45)(U/c_m-1.17)},   &amp;amp; \mbox{for } \omega \ge \omega_m \mbox{ and } U &amp;gt; c_m\\&lt;br /&gt;
\\&lt;br /&gt;
\left ( 6.97 + 0.83 \right )\left ( \frac{\omega}{\omega_m} \right )^{4.06+0.22},   &amp;amp; \mbox{for } \omega &amp;lt; \omega_m \mbox{ and } U &amp;gt; c_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2660</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2660"/>
		<updated>2025-02-08T02:46:53Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}\left ( \frac{\theta}{2} \right )\right |^{2s} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\left ( 9.77 + 0.43 \right )\left ( \frac{\omega}{\omega_m} \right )^{-(2.33+0.06)-(1.45+0.45)(U/c_m-1.17)},   &amp;amp; \mbox{for } \omega \ge \omega_m \mbox{ and } U &amp;gt; c_m\\&lt;br /&gt;
\\&lt;br /&gt;
\left ( 6.97 + 0.83 \right )\left ( \frac{\omega}{\omega_m} \right )^{4.06+0.22},   &amp;amp; \mbox{for } \omega &amp;lt; \omega_m \mbox{ and } U &amp;gt; c_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\bar{\omega} = \left ( \frac{\omega_mU}{g} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2659</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2659"/>
		<updated>2025-02-08T02:39:57Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Mitsuyasu Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}^{2s}\left ( \frac{\theta}{2} \right )\right | &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}^{2s}\left ( \frac{\theta}{2} \right )\right | &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\left ( 9.77 + 0.43 \right )\left ( \frac{\omega}{\omega_m} \right )^{-(2.33+0.06)-(1.45+0.45)(U/c_m-1.17)},   &amp;amp; \mbox{for } \omega \ge \omega_m \mbox{ and } U &amp;gt; c_m\\&lt;br /&gt;
\\&lt;br /&gt;
\left ( 6.97 + 0.83 \right )\left ( \frac{\omega}{\omega_m} \right )^{4.06+0.22},   &amp;amp; \mbox{for } \omega &amp;lt; \omega_m \mbox{ and } U &amp;gt; c_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\bar{\omega} = \left ( \frac{\omega_mU}{g} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2658</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2658"/>
		<updated>2025-02-08T02:37:05Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]], [[#Hasselmann_Directional_Spreading_Function|Hasselmann Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Mitsuyasu Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
Mitsuyasu et al. (1975) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}^{2s}\left ( \frac{\theta}{2} \right )\right | &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^5,   &amp;amp; \mbox{for } \omega \le \omega_m \\&lt;br /&gt;
\\&lt;br /&gt;
s_m\left ( \frac{\omega}{\omega_m} \right )^{-2.5},   &amp;amp; \mbox{for } \omega &amp;gt; \omega_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s_m = 11.5\left ( \frac{\omega_mU}{g} \right )^{-2.5}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Mitsuyasu Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Hasselmann Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
From analysis of measured data, Hasselmann et al. (1980) propose the following directional spreading function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta, \omega) = \frac{2^{2s-1}}{\pi}\frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\left | \mbox{cos}^{2s}\left ( \frac{\theta}{2} \right )\right | &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;s =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\left ( 9.77 + 0.43 \right )\left ( \frac{\omega}{\omega_m} \right )^{-(2.33+0.06)-(1.45+0.45)(U/c_m-1.17)},   &amp;amp; \mbox{for } \omega \ge \omega_m \mbox{ and } U &amp;gt; c_m\\&lt;br /&gt;
\\&lt;br /&gt;
\left ( 6.97 + 0.83 \right )\left ( \frac{\omega}{\omega_m} \right )^{4.06+0.22},   &amp;amp; \mbox{for } \omega &amp;lt; \omega_m \mbox{ and } U &amp;gt; c_m&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\bar{\omega} = \left ( \frac{\omega_mU}{g} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|ModalFrequency}}: The modal frequency.&lt;br /&gt;
* {{PropertyData|MeanWindSpeed}} : The mean wind speed.&lt;br /&gt;
* {{PropertyData|WaveCelerity}} : The wave celerity corresponding to the modal frequency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Hasselmann Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2657</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2657"/>
		<updated>2025-02-08T00:40:02Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]], [[#Cosine_Squared_Directional_Spreading_Function|Cosine Squared Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cosine Squared Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The cosine squared directional spreading function assumes that spreading is proportional to &amp;lt;math&amp;gt;(cos 0)^2&amp;lt;/math&amp;gt;. It does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \left ( \frac{2}{\pi} \right )\mbox{cos}^{2}\left ( \theta \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cosine Squared Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2656</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2656"/>
		<updated>2025-02-08T00:11:16Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Cos2s Directional Spreading Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta -\theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cos2s Directional Spreading Function&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Directional Spreading Function&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spreading = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spreading:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spreading function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MinDirection = &#039;-90 deg&#039;&lt;br /&gt;
    sim.MaxDirection = &#039;90 deg&#039;&lt;br /&gt;
    sim.NumberOfDirectionIncrements = 1024&lt;br /&gt;
    sim.DirectionIncrement = (sim.MaxDirection-sim.MinDirection)/sim.NumberOfDirectionIncrements &lt;br /&gt;
    sim.setActiveFeature(spreading)         &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the spreading function for the frequency value of 0.25 rad/s.&lt;br /&gt;
    frequency = 0.04 #hz&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least one simulation point.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spreading function vector for a frequency of 0.24 rad/s&lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spreadings = sim.computeDirectionalSpreadingFunctionVectorD(v1, frequency)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spreadings), len(spreadings[0]), spreadings)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2655</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2655"/>
		<updated>2025-02-07T23:11:24Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]], [[#Cos2s_Directional_Spreading_Function|Cos2s Directional Spreading Function]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cos2s Directional Spreading Function ==&lt;br /&gt;
&lt;br /&gt;
The Cos2s directional spreading function is based on the cosine function with a spreading parameter which does not vary with frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D(\theta) = \frac{\Gamma^2\left ( s+1\right )}{\Gamma\left ( 2s+1\right )}\mbox{cos}^{2s}\left ( \frac{\theta \theta_0}{2} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PrincipalWaveDirection}}: The angle defining the principal direction in which the wave is propagating.&lt;br /&gt;
* {{PropertyData|SpreadingExponent}} :The spreading exponent.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2654</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2654"/>
		<updated>2025-02-07T22:28:35Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* WEN Spectrum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;4 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2653</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2653"/>
		<updated>2025-02-07T17:44:52Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* WEN Spectrum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2652</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2652"/>
		<updated>2025-02-07T17:43:47Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* WEN Spectrum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) =  \frac{m_0}{\omega_w} \frac{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )}{ 5.813− 5.137\eta} \left ( \frac{1.15\omega_w}{\omega} \right )^m, \quad \mbox{for } \omega \ge 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}} significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|DepthParameter}}: The depth parameter taken between 0 and 0.5.&lt;br /&gt;
* {{PropertyData|TenMetersHeightMeanWindSpeed}} the mean wind speed at 10 meters above ground.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2651</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2651"/>
		<updated>2025-02-07T17:23:56Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* WEN Spectrum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
WEN spectrum is the wave spectrum of China offshore. It can describe the different stages of wind wave growth and adapt to different water depths:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{m_0p}{\omega_w}\mbox{exp}\left \{ -95\left [ ln\frac{p \left ( 5.813− 5.137\eta \right )}{\left ( 6.77− 1.088p+0.013p^2 \right )\left ( 1.307− 1.426\eta \right )} \right ]\left ( \frac{\omega}{\omega_0} - 1\right )^{12/5} \right \}, \quad \mbox{for } 0 \le \omega \le 1.15\omega_w&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2650</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2650"/>
		<updated>2025-02-07T16:57:08Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* Scott Spectrum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2649</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2649"/>
		<updated>2025-02-07T16:55:36Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]], [[#WEN_Spectrum|WEN Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== WEN Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ], \quad \mbox{for } -0.26&amp;lt;\omega-\omega_p &amp;lt; 1.65 \mbox{ and } 0 \mbox{ elsewhere.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;WEN Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2648</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2648"/>
		<updated>2025-02-07T16:27:46Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]], [[#Scott_Spectrum|Scott Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Scott Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = 0.214 H^2_s\mbox{exp}\left [ -\frac{1}{0.065}\left ( \frac{\omega-\omega_p}{ \omega-\omega_p +0.26} \right )^{1/2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: the significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}} the peak frequency of the spectrum.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Scott Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2647</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2647"/>
		<updated>2025-02-07T15:08:15Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: /* ITTC Spectrum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -\frac{4\alpha g^2\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2646</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2646"/>
		<updated>2025-02-07T15:06:15Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]], [[#ITTC_Spectrum|ITTC Spectrum]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ITTC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
 The Pierson Moskowitz spectrum was modified in the International Towing Tank Conference (1966, 1969,1972) given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \alpha g^2\omega^{-5}\mbox{exp}\left (  -4\alpha g^2\frac{\omega^{-4}}{H^2_s} \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PhillipsConstant}}:The Phillips Constant (0.0081 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ITTC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
	<entry>
		<id>https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2645</id>
		<title>Plugin SeaLab</title>
		<link rel="alternate" type="text/html" href="https://wiki.labrps.com/index.php?title=Plugin_SeaLab&amp;diff=2645"/>
		<updated>2025-02-07T14:28:27Z</updated>

		<summary type="html">&lt;p&gt;LabRPS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Plugin&lt;br /&gt;
|Name=SeaLab Plugin&lt;br /&gt;
|Description=This plugin implements various SeaLab features.&lt;br /&gt;
|Author=Koffi Daniel&lt;br /&gt;
|Version=1.0&lt;br /&gt;
|Date=2024-04-15&lt;br /&gt;
|Features= [[#Horizontal_Uniform_Distribution|Horizontal Uniform Distribution]], [[#Vertical_Uniform_Distribution|Vertical Uniform Distribution]], [[#Uniform_Distribution|Uniform Distribution]], [[#Grid_Points|Grid Points]], [[#General_Distribution|General Distribution]], [[#Import_Simulation_Points_from_File|Import Simulation Points from File]], [[#Uniform_Random_Phases|Uniform Random Phases]], [[#Uniform_Random_Phases_Import|Uniform Random Phases Import]], [[#Double_Index_Frequency_Discretization|Double Index Frequency Discretization]], [[#Single_Index_Frequency_Discretization|Single Index Frequency Discretization]], [[#Zerva_Frequency_Discretization|Zerva Frequency Discretization]], [[#Cholesky_Decomposition|Cholesky Decomposition]], [[#Pierson_Moskowitz_Spectrum_1964|Pierson Moskowitz Spectrum (1964)]], [[#Jonswap_Spectrum_1974|Jonswap Spectrum (1974)]], [[#Gaussian_Swell_Spectrum|Gaussian Swell Spectrum]], [[#Ochi_Hubble_Spectrum|Ochi-Hubble Spectrum]], [[#Torsethaugen_Spectrum|Torsethaugen Spectrum]],[[#Bretschneider_Spectrum|Bretschneider Spectrum]], [[#ISSC_Spectrum|ISSC Spectrum]]&lt;br /&gt;
&lt;br /&gt;
|RPSVersion=All&lt;br /&gt;
}}&lt;br /&gt;
You can find the source code of this plugin on the following Github repository: [https://github.com/LabRPS/LabRPS-plugins/tree/master/SeaLab/SeaLabPlugin Get the code here!]. This plugin is one of the official plugins provided by LabRPS. It provides very useful features (tools) for the simulation of random sea elevations. Plugins are very easy to create in LabRPS, therefore, anyone can develop plugin for any random phenomenon in LabRPS. Go to this [[Plugin_Creation|page]] to see how to create new plugin for LabRPS. You can get quick assistance from LabRPS community by sending your concern to the [https://labrps.com/boards community forum].&lt;br /&gt;
&lt;br /&gt;
== Horizontal Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a horizontal line that is parallel to one of the coordinate system axis. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Horizontal Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 80m)&lt;br /&gt;
    newFeature.FirstPoint = vec(0,0,80000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Vertical Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature provides an efficient method to distribute random sea elevations simulation points uniformly in space. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a vertical line. This uniform distribution is critical in certain simulation methods. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|LowestPoint}}: This is a point in 3D space representing the lowest point the distribution will start from. In many applications, this point should not be lower than 10 meters.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Vertical Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    newFeature= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not newFeature:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    newFeature.LowestPoint  = vec(0,0,30000)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    newFeature.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;newFeature&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Distribution ==&lt;br /&gt;
&lt;br /&gt;
This feature may be seen as a general form of the horizontal and the vertical distribution features. It allows users to generate a set of points within a 3D spatial domain, ensuring that the points are evenly distributed along a line parallel to one of the coordinate system axis. For &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; simulation points &amp;lt;math&amp;gt;(P_1,P_2,P_3,...,P_n)&amp;lt;/math&amp;gt;, the distance &amp;lt;math&amp;gt;d_{jk}&amp;lt;/math&amp;gt; between points &amp;lt;math&amp;gt;P_j&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_k&amp;lt;/math&amp;gt; must be given by the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;d_{jk} = s\times|j-k|&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; is the even space between any two adjacent points.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FirstPoint}}: This is a point in 3D space representing the first point the distribution will start from. This should be the lowest point in case the distribution is parallel to the vertical axis and should not be lower than 10 meters in many application.&lt;br /&gt;
* {{PropertyData|Spacing}}: This is the even space between any two adjacent points in the distribution.&lt;br /&gt;
* {{PropertyData|Direction}}: Its value can be X, Y or Z. This is the axis the points distribution is parallel to.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
This feature can be used to produce vertical distribution as we did before in the Vertical Distribution feature.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
import LabRPS&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Uniform Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
        LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
        return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    unifSimPoints.Direction= &#039;Z&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the first point of the distribution (x =0, y = 0, z = 30m)&lt;br /&gt;
    unifSimPoints.FirstPoint = vec(0,0,30000) # This is the lowest point in this case (Direction = &#039;Z&#039;)&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing (s = 10m)&lt;br /&gt;
    unifSimPoints.Spacing = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Grid Points ==&lt;br /&gt;
&lt;br /&gt;
This feature allows users to generate a set of grid points within a 3D spatial domain, ensuring that the points are evenly distributed in a plane parallel to one of the coordinate system planes (XY Plane, YZ Plane, XZ Plane). &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Spacing1}}: This is the points spacing along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Spacing2}}: This is the points spacing along the second axis.&lt;br /&gt;
* {{PropertyData|Length1}}: This is the length within points are distributed along one of the axis forming the plane.&lt;br /&gt;
* {{PropertyData|Length2}}: This is the length within points are distributed along the second axis.&lt;br /&gt;
* {{PropertyData|CenterPoint}}: This is the center of the grid around which the points are generated. It is a 3D point.&lt;br /&gt;
* {{PropertyData|NumberOfPoints}}: This is the resulting total number of points in the grid. This is a read only property for internal use. User cannot change its value directly. &lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Grid Points&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    unifSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not unifSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the plan the points grid is parallel to&lt;br /&gt;
    unifSimPoints.LocationPlan= &#039;YZ Plane&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the center point of the distribution (x =0, y = 0, z = 0)&lt;br /&gt;
    unifSimPoints.CenterPoint = vec(0,0,0) &lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing1 (s1 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing1 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the spacing2 (s2 = 10m)&lt;br /&gt;
    unifSimPoints.Spacing2 = &#039;10m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length1 (l1 = 200m)&lt;br /&gt;
    unifSimPoints.Length1= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # let&#039;s set the length2 (l2 = 200m)&lt;br /&gt;
    unifSimPoints.Length2= &#039;200m&#039;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;unifSimPoints&amp;quot; feature.&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # Example 3D points&lt;br /&gt;
    x = arr[:,1]&lt;br /&gt;
    y = arr[:,2]&lt;br /&gt;
    z = arr[:,3]&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
    # Create a figure&lt;br /&gt;
    fig = plt.figure()&lt;br /&gt;
&lt;br /&gt;
    # Add 3D axes&lt;br /&gt;
    ax = fig.add_subplot(111, projection=&#039;3d&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Plot points&lt;br /&gt;
    ax.scatter(x, y, z, color=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Hide all axes and labels&lt;br /&gt;
    ax.set_axis_off()&lt;br /&gt;
&lt;br /&gt;
    # Set the title&lt;br /&gt;
    ax.set_title(&#039;3D Plotting of Points&#039;)&lt;br /&gt;
&lt;br /&gt;
    # Show the plot&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== General Distribution ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points distribution is more general and does not follow any of the previous uniform distribution, this feature can be used. This feature allows users to input simulation points one by one using their coordinates based on the vector dialog shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic005_SeaLab_Feat_Locations_2.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|Locations}}: This is a list holding the simulation points&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;General Distribution&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    genSimPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not genSimPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the uniform points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # create the simulation points by their coordinates&lt;br /&gt;
    v1 = vec(0, 0, 35000)&lt;br /&gt;
    v2 = vec(0, 0, 40000)&lt;br /&gt;
    v3 = vec(0, 0, 140000)&lt;br /&gt;
&lt;br /&gt;
    # add the points to the locations&lt;br /&gt;
    genSimPoints.Locations = [v1, v2, v3]&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;genSimPoints&amp;quot; feature&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(simPoints)&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, simPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Import Simulation Points from File ==&lt;br /&gt;
&lt;br /&gt;
When the simulation points are stored in a file, this feature can be used. The feature allows users to import simulation points coordinates from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of simulation points and four, respectively.&lt;br /&gt;
&lt;br /&gt;
[[Image:SeaLab_Tutorial001_Pic006_SeaLab_Feat_Locations_1.png|400px]] &lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Import Simulation Points from File&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Location Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    simPoints= SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not simPoints:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the simulation points feature.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # set the direction of the distribution to be vertical&lt;br /&gt;
    simPoints.FilePath = &amp;quot;D:/Points.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates. SeaLab will internally use the &amp;quot;simPoints&amp;quot; feature.&lt;br /&gt;
    importedSimPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
    arr = numpy.asarray(importedSimPoints )&lt;br /&gt;
&lt;br /&gt;
    # you can also show the result in a table, pass False as last argument to the function to ask &lt;br /&gt;
    # LabRPS to only show the data without plotting them&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfSpatialPosition, 4, importedSimPoints, False)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases ==&lt;br /&gt;
&lt;br /&gt;
In the simulation of random sea elevations, one common technique is to represent the random sea elevations as a sum of multiple sinusoidal components in the frequency domain. Each of these components is associated with a random phase, which determines the position of the sine wave relative to time. By assigning uniform random phases to each frequency component, the resulting time series will have random characteristics, while still adhering to the desired spectral properties, such as a specific power spectral density (PSD) or turbulence spectrum. The feature generate &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; sequences &amp;lt;math&amp;gt;(\phi_{1l}, \phi_{2l}, \phi_{3l},..., \phi_{nl}; l = 1, 2, 3, ..., N)&amp;lt;/math&amp;gt; of independent random phase angles &lt;br /&gt;
uniformly distributed over the interval &amp;lt;math&amp;gt;[0, 2\pi]&amp;lt;/math&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|MinimumValue}}: The minimum value that can be generated&lt;br /&gt;
* {{PropertyData|MaximumValue}}: The maximum value that can be generated&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.MinimumValue = 0&lt;br /&gt;
 randomness.MaximumValue = 6.28&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
 randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Uniform Random Phases Import ==&lt;br /&gt;
&lt;br /&gt;
When the simulation numbers are stored in a file, this feature can be used. The feature allows users to import random numbers from file. Note that, for now only tab separated text file is supported and the file is expected to have number of rows and number of columns which are number of frequency increments and number of simulation points, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|FilePath}}: This is the path to the file.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Uniform Random Phases Import&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Randomness Provider&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 randomness = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not randomness:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the randomness feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 randomness.FilePath = &amp;quot;myfolderpath/myfile.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # generate random phase angle&lt;br /&gt;
  randomnessMatrix = sim.generateRandomMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(randomnessMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Single Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = l\Delta\omega;  \quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Single Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Double Index Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allows to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{ml} = (l-1)\Delta\omega + \frac{m}{n}\Delta\omega; \quad m = 1, 2, 3, ..., n; \quad  l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of simulation points,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Double Index Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
 frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Zerva Frequency Discretization ==&lt;br /&gt;
&lt;br /&gt;
This feature allow to discretize continuous frequency according to the following formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_{l} = (1+\frac{l}{2})\Delta\omega;\quad l = 1, 2, 3, ..., N&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;\Delta\omega&amp;lt;/math&amp;gt; is the frequency increment,&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of frequency increments,&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The following script shows how this feature can be created and used.&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
 # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
 sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
 # check if the simulation does really exist&lt;br /&gt;
 if not sim:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
     # abord the computation &lt;br /&gt;
  &lt;br /&gt;
 featureType = &amp;quot;Zerva Frequency Discretization&amp;quot;&lt;br /&gt;
 featureGroup = &amp;quot;Frequency Distribution&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
 # case you don&#039;t understand the next line)&lt;br /&gt;
 frequency = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
 # check if the created feature is good&lt;br /&gt;
 if not frequency:&lt;br /&gt;
     LabRPS.Console.PrintError(&amp;quot;Error on creating the frequency feature.\n&amp;quot;)&lt;br /&gt;
     # abord the computation&lt;br /&gt;
&lt;br /&gt;
 # compute the freqency distribution&lt;br /&gt;
  frequencyMatrix = sim.computeFrequenciesMatrixFP()&lt;br /&gt;
&lt;br /&gt;
 # now you can convert the coordinate matrix to numpy array and use it for any other purposes&lt;br /&gt;
 arr = numpy.asarray(frequencyMatrix)&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Cholesky Decomposition ==&lt;br /&gt;
&lt;br /&gt;
This feature performs the [https://en.wikipedia.org/wiki/Cholesky_decomposition Cholesky decomposition] of a positive Hermitian power spectrum matrix and returns the lower triangular matrix (L) of the decomposition. The Cholesky decomposition is a numerical method used to decompose a positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. Specifically, for a matrix &lt;br /&gt;
A, the decomposition is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt;\mathbf{A} = \mathbf{L L}^{*},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;math display=block&amp;gt; L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i&amp;gt;j. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is a [https://en.wikipedia.org/wiki/Triangular_matrix lower triangular matrix] with real and positive diagonal entries, and &amp;lt;math&amp;gt;L^*&amp;lt;/math&amp;gt; denotes the [https://en.wikipedia.org/wiki/Conjugate_transpose conjugate transpose] of &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The feature is optimized for performance and can handle large matrices efficiently using &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; computational complexity in the worst case. It checks if the input matrix is indeed positive-definite and Hermitian before performing the decomposition and raises an error if the matrix does not meet these conditions. The feature belong to the [[RPS_Feature_Group#PSD_Decomposition_Method|PSD Decomposition Method]] feature group.&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
* A [[SeaLab_Feature#Spectrum| spectrum feature]]&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
import LabRPS&lt;br /&gt;
import numpy&lt;br /&gt;
&lt;br /&gt;
def compute():&lt;br /&gt;
    installResuslt = SeaLab.installPlugin(&amp;quot;SeaLabPlugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    doc = LabRPS.ActiveDocument&lt;br /&gt;
    if not doc:&lt;br /&gt;
       doc = LabRPS.newDocument()&lt;br /&gt;
&lt;br /&gt;
    # create SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLabObjects.makeSimulation(doc, &amp;quot;Simulation&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
    # check if the simulation sucessfully created&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Cholesky Decomposition&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Spectrum Decomposition Method&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature&lt;br /&gt;
    decomposedPSD = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not decomposedPSD :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum decomposition method.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
    &lt;br /&gt;
    # get the active simulation points feature and compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # use a vector to represent a simulation point based on its coordinates&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    v2 = vec(simPoints[1][1], simPoints[1][2], simPoints[1][3])&lt;br /&gt;
    v3 = vec(simPoints[2][1], simPoints[2][2], simPoints[2][3])&lt;br /&gt;
&lt;br /&gt;
    # This feature is used to decompose power spectrum matrices which may vary in time. Let&#039;s assume that&lt;br /&gt;
    # the active power spectrun density function in this example is stationary. Meanning it is not varying in time.&lt;br /&gt;
    #Then, we use time instant of 0 second.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the decomposed cross spectrum between points 1 and 3, at time instant of 0 second and for all frequency&lt;br /&gt;
    # increments. Note that when the following code is run, SeaLab will try to identify the active frequency distribution, &lt;br /&gt;
    # the active power spectrum feature, the active coherence function feature and others. If SeaLab fails to find any &lt;br /&gt;
    # of these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    psd13 = sim.computeDecomposedCrossSpectrumVectorF(v1, v3, time)&lt;br /&gt;
&lt;br /&gt;
    # psd13 can be converted to numpy vector and be used for some other purposes.&lt;br /&gt;
    arr = numpy.asarray(psd13)&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Pierson Moskowitz Spectrum 1964 ==&lt;br /&gt;
&lt;br /&gt;
Various idealized spectra are used to answer the question in oceanography and ocean engineering. Perhaps the simplest is that proposed by Pierson and Moskowitz 1964. They assumed that if the wind blew steadily for a long time over a large area, the waves would come into equilibrium with the wind. This is the concept of a fully developed sea (a sea produced by winds blowing steadily over hundreds of miles for several days).Here, a long time is roughly ten-thousand wave periods, and a &amp;quot;large area&amp;quot; is roughly five-thousand wave-lengths on a side. ([https://wikiwaves.org/Ocean-Wave_Spectra#Pierson-Moskowitz_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Pierson Moskowitz Spectrum (1964)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Jonswap Spectrum 1974 ==&lt;br /&gt;
&lt;br /&gt;
Hasselmann et al. 1973, after analyzing data collected during the Joint North Sea Wave Observation Project JONSWAP, found that the wave spectrum is never fully developed. It continues to develop through non-linear, wave-wave interactions even for very long times and distances. Hence an extra and somewhat artificial factor was added to the Pierson-Moskowitz spectrum in order to improve the fit to their measurements. The JONSWAP spectrum is thus a Pierson-Moskowitz spectrum multiplied by an extra peak enhancement factor &amp;lt;math&amp;gt;\gamma ^r&amp;lt;/math&amp;gt; ([https://wikiwaves.org/Ocean-Wave_Spectra#JONSWAP_Spectrum source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \frac{5}{16}A_{\gamma}H^2_s\omega^4_p\omega^{-5}\mbox{exp}\left [ -\frac{5}{4}\left ( \frac{\omega}{\omega_p} \right )^{-4} \right ]\gamma^r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{\gamma} = 1 - 0.287 \times ln\left ( \gamma \right )  \quad \mbox{is a normalizing factor} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \mbox{exp}\left [ -\frac{1}{2}\left ( \frac{\omega-\omega_p}{\sigma\omega_p} \right )^{2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma =&lt;br /&gt;
\begin{cases} &lt;br /&gt;
\sigma_1,   &amp;amp; \mbox{for } \omega \le \omega_p \\&lt;br /&gt;
\\&lt;br /&gt;
\sigma_2,   &amp;amp; \mbox{for } \omega &amp;gt; \omega_p &lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Jonswap Spectrum (1974)&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Gaussian Swell Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Gaussian swell spectrum is based on the normal (or Gaussian) probability density function and is defined as ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \left ( \frac{H_c}{4} \right )^2\frac{1}{\sigma\sqrt{2\pi}}\mbox{exp}\left [ -\frac{\left ( \omega -\omega_p \right )^2}{2\sigma^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakFrequency}}: The peak frequency.&lt;br /&gt;
* {{PropertyData|Sigma}}: The width of spectral peak sigma.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Gaussian Swell Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Ochi Hubble Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Ochi-Hubble spectrum allows double-peaked spectra to be set up, enabling you to represent sea states that include both a remotely generated swell and a local wind generated sea. See the Ochi-Hubble paper for full details. ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = \sum_{j=1}^2 \left\{ \frac{\left(\frac{4\lambda_j+1}{4}\right)^{\lambda_j} \omega_{\mathrm{m}_j}^{4\lambda_j}H_{\mathrm{s}_j}^2}{4\Gamma(\lambda_j)} \right\}&lt;br /&gt;
            \omega^{-(4\lambda_j+1)}&lt;br /&gt;
            \exp\left\{ -\left(\frac{4\lambda_j+1}{4}\right) \left(\frac{\omega}{\omega_{\mathrm{m}_j}}\right)^{-4} \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|PeakShape1}}: The peak shape of the first peak.&lt;br /&gt;
* {{PropertyData|PeakShape2}}: The peak shape of the second peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency1}}: The peak frequency of the first peak.&lt;br /&gt;
* {{PropertyData|PeakFrequency2}}: The peak frequency of the second peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight1}}: The significant wave height of the first peak.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight2}}: The significant wave height of the second peak.&lt;br /&gt;
* {{PropertyData|AutoPara}}: Whether to automatically compute the six previous parameter.&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height used the calculate those six parameters in case of automatic parameters calculation .&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Ochi-Hubble spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Torsethaugen Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Torsethaugen spectrum is another two-peaked spectrum, more suited to North Sea application than Ochi-Hubble. The spectrum is defined by two user input parameters, &amp;lt;math&amp;gt;H_s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_p (= 1/f_m)&amp;lt;/math&amp;gt;. In order to define the spectrum we must first define a number of other terms ([https://www.orcina.com/webhelp/OrcaFlex/Content/html/Waves,Wavespectra.htm source]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
a_1 = 0.5 \\&lt;br /&gt;
a_2 = 0.3 \\&lt;br /&gt;
a_3 = 6 \\&lt;br /&gt;
a_{10} = 0.7 \\&lt;br /&gt;
a_{20} = 0.6 \\&lt;br /&gt;
b_1 = 2\ \textrm{s} \\&lt;br /&gt;
G_0 = 3.26 \\&lt;br /&gt;
k_g = 35 \\&lt;br /&gt;
k_1 = 0.0016 \\&lt;br /&gt;
k_2 = 0.286 \\&lt;br /&gt;
k_3 = \frac{k_2}{k_1^{1/3}} \\&lt;br /&gt;
k_f = k_3 g^{-1/2} \\&lt;br /&gt;
F_e = 370,000\ \textrm{m} \\&lt;br /&gt;
a_f = k_f F_e^{1/6} \\&lt;br /&gt;
T_{pf} = a_f H_s^{1/3} \\&lt;br /&gt;
a_e = 2\ \textrm{sm}^{-1/2} \\&lt;br /&gt;
T_l = a_e H_s^{1/2} \\&lt;br /&gt;
T_u = 25\ \textrm{s} \\&lt;br /&gt;
\epsilon_l = \frac{T_{pf} - T_p}{T_{pf} - T_l} \\&lt;br /&gt;
\epsilon_u = \frac{T_p - T_{pf}}{T_u - T_{pf}} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&amp;lt;math&amp;gt; \mbox{If }\epsilon_l &amp;lt; 0  \mbox{ then } \epsilon_l \mbox{ is set to 0. If } \epsilon_l &amp;gt; 1  \mbox{ then } \epsilon_l  \mbox{ is set to 1. Likewise for } \epsilon_u.\\&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For wind dominated sea, &amp;lt;math&amp;gt;T_p \le T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_w = (1 - a_{10}) \exp\{-(\epsilon_l/a_1)^2\} + a_{10} \\&lt;br /&gt;
H_1 = R_w H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_p = \frac{2\pi}{g}\frac{H_1}{T_{p1}^2} \\&lt;br /&gt;
\gamma = k_g s_p^{6/7} \\&lt;br /&gt;
H_2 = (1 - R_w^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = T_{pf} + b_1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For swell dominated sea, &amp;lt;math&amp;gt;T_p &amp;gt; T_{pf}&amp;lt;/math&amp;gt;, we define:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
R_s = (1 - a_{20}) \exp(-(\epsilon_u/a_2)^2) + a_{20} \\&lt;br /&gt;
H_1 = R_s H_s \\&lt;br /&gt;
T_{p1} = T_p \\&lt;br /&gt;
s_f = \frac{2\pi}{g}\frac{H_s}{T_{pf}^2} \\&lt;br /&gt;
\gamma_f = k_g s_f^{6/7} \\&lt;br /&gt;
\gamma = \gamma_f (1 + a_3 \epsilon_u) \\&lt;br /&gt;
H_2 = (1 - R_s^2)^{1/2} H_s \\&lt;br /&gt;
T_{p2} = a_f H_2^{1/3} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If &amp;lt;math&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is set to 1.&lt;br /&gt;
&lt;br /&gt;
These two branches of the formulation define &amp;lt;math&amp;gt;H_1, H_2, T_{p1}, T_{p2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; which are then used to define the spectrum as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(f) = \sum_{j=1}^2 E_j S_{jn}(f_{jn})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{lcl}&lt;br /&gt;
j = 1\ \textrm{is the primary sea system} \\&lt;br /&gt;
j = 2\ \textrm{is the secondary sea system} \\&lt;br /&gt;
f_{1n} = f T_{p1} \\&lt;br /&gt;
f_{2n} = f T_{p2} \\&lt;br /&gt;
\sigma =&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
    0.07 \quad  \mbox{for } f_{1n} \le 1 \\&lt;br /&gt;
    0.09 \quad  \mbox{for } f_{1n} \gt 1 \\&lt;br /&gt;
    \end{cases} \\&lt;br /&gt;
E_1 = (1/16) H_1^2 T_{p1} \\&lt;br /&gt;
E_2 = (1/16) H_2^2 T_{p2} \\&lt;br /&gt;
A_\gamma = \frac{1 + 1.1 \log_e(\gamma)^{1.19}}{\gamma} \\&lt;br /&gt;
S_{1n}(f_{1n}) = G_0 A_\gamma f_{1n}^{-4} \exp(-f_{1n}^{-4}) \gamma^{\exp\{-(1/2\sigma^2) (f_{1n} - 1)^2\}} \\&lt;br /&gt;
S_{2n}(f_{2n}) = G_0 f_{2n}^{-4} \exp(-f_{2n}^{-4}) \\&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|PeakPeriod}}: The peak period.&lt;br /&gt;
* {{PropertyData|AutoGamma}}: Whether to automatically compute gamma or not.&lt;br /&gt;
* {{PropertyData|AutoSigma}}: Whether to automatically compute sigma or not.&lt;br /&gt;
* {{PropertyData|Gamma}}: The value of shape parameter gamma.&lt;br /&gt;
* {{PropertyData|Sigma1}}: The width of spectral peak sigma 1.&lt;br /&gt;
* {{PropertyData|Sigma2}}: The width of spectral peak sigam 2.&lt;br /&gt;
* {{PropertyData|DoublePeaks}}: Whether double peaks or not.&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Torsethaugen Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== Bretschneider Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The Bretschneider Spectrum is a two-parameter spectral model based on the assumption that the waves are narrow-banded with the wave characteristics following the Rayleigh distribution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.2107 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-0.8429 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;Bretschneider Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;br /&gt;
&lt;br /&gt;
== ISSC Spectrum ==&lt;br /&gt;
&lt;br /&gt;
The International Ship Structures Congress (1964) suggested slight modification &lt;br /&gt;
of the Bretschneider spectrum given as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;S(\omega) = C_1\times H^2_s\left ( \frac{\omega^4_0}{\omega^5} \right )\mbox{exp}\left [ C_2\left ( \frac{\omega_0}{\omega} \right )^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Feature Dependency === &lt;br /&gt;
The features required by this feature are summarized as follows:&lt;br /&gt;
&lt;br /&gt;
* A [[RPS_Feature_Group#Location_Distribution| simulation points feature]]&lt;br /&gt;
* A [[RPS_Feature_Group#Frequency_Distribution| frequency discretization feature]]&lt;br /&gt;
&lt;br /&gt;
=== Properties === &lt;br /&gt;
&lt;br /&gt;
* {{PropertyData|SignificantWaveHeight}}: The significant wave height.&lt;br /&gt;
* {{PropertyData|SignificantWavePeriod}}: The significant wave period defined as the average period of the significant waves.&lt;br /&gt;
* {{PropertyData|Constant1}}: A constant (0.3123 by default).&lt;br /&gt;
* {{PropertyData|Constant2}}: A constant (-1.2489 by default).&lt;br /&gt;
&lt;br /&gt;
=== Scripting === &lt;br /&gt;
&lt;br /&gt;
The feature can be used from the python console as follows:&lt;br /&gt;
&lt;br /&gt;
{{Code|code=&lt;br /&gt;
import SeaLab&lt;br /&gt;
import SeaLabObjects&lt;br /&gt;
import GeneralToolsGui&lt;br /&gt;
import LabRPS&lt;br /&gt;
from LabRPS import Vector as vec&lt;br /&gt;
&lt;br /&gt;
# Before you run this code, you should first have created a document with a SeaLab simulation with &lt;br /&gt;
# active simulation points and frequency distribution&lt;br /&gt;
def compute():&lt;br /&gt;
    &lt;br /&gt;
    # get an existing SeaLab simulation called &amp;quot;Simulation&amp;quot;&lt;br /&gt;
    sim = SeaLab.getSimulation(&amp;quot;Simulation&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    # check if the simulation does really exist&lt;br /&gt;
    if not sim:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;The simulation does not exist.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
  &lt;br /&gt;
    featureType = &amp;quot;ISSC Spectrum&amp;quot;&lt;br /&gt;
    featureGroup = &amp;quot;Frequency Spectrum&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    # create the feature and add it to the existing simulation (you may refer to the SeaLab Workbench page in &lt;br /&gt;
    # case you don&#039;t understand the next line)&lt;br /&gt;
    spectrum = SeaLabObjects.makeFeature(&amp;quot;MyNewFeature&amp;quot;, sim.Name, featureType, featureGroup)&lt;br /&gt;
    &lt;br /&gt;
    # check if the created feature is good&lt;br /&gt;
    if not spectrum:&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Error on creating the spectrum function feature.\n&amp;quot;)&lt;br /&gt;
       return None &lt;br /&gt;
    &lt;br /&gt;
    sim.MaxFrequency = &#039;0.04 1/s&#039;&lt;br /&gt;
    sim.NumberOfFrequency = 1024&lt;br /&gt;
    sim.FrequencyIncrement = sim.MaxFrequency/sim.NumberOfFrequency &lt;br /&gt;
    sim.setActiveFeature(spectrum)        &lt;br /&gt;
&lt;br /&gt;
    # For this example we shall compute the cross spectrum matrix at time instant of 0 second and for the frequency value of 0.25 rad/s.&lt;br /&gt;
    time = 0.0&lt;br /&gt;
&lt;br /&gt;
    # compute the simulation points coordinates&lt;br /&gt;
    simPoints = sim.computeLocationCoordinateMatrixP3()&lt;br /&gt;
&lt;br /&gt;
    if not simPoints :&lt;br /&gt;
       LabRPS.Console.PrintError(&amp;quot;Make sure you have an active location disttribution in the simulation with at least 3 simulation points.\n&amp;quot;)&lt;br /&gt;
       return None&lt;br /&gt;
&lt;br /&gt;
    # let pick the first simulation point&lt;br /&gt;
    v1 = vec(simPoints[0][1], simPoints[0][2], simPoints[0][3])&lt;br /&gt;
    # compute the spectrum vector at time instant of 0 second &lt;br /&gt;
    # Note that when the following code is run, SeaLab will try to identify the active locations distribution, the active frequency discretization,&lt;br /&gt;
    # If SeaLab fails to find these dependency features, the computation will fails and specific error messages will be sent to the report view.&lt;br /&gt;
    spectrums = sim.computeAutoFrequencySpectrumVectorF(v1, time)&lt;br /&gt;
&lt;br /&gt;
    # show the results&lt;br /&gt;
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(spectrums), len(spectrums[0]), spectrums)&lt;br /&gt;
    LabRPS.ActiveDocument.recompute()&lt;br /&gt;
&lt;br /&gt;
compute()&lt;br /&gt;
}}&lt;br /&gt;
[[#top| Back to the Top ]]&lt;/div&gt;</summary>
		<author><name>LabRPS</name></author>
	</entry>
</feed>