Getting Data

This section introduces the functions that can be used to get properties and result data from objects.

Accessing data

get

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK · INTERCONNECT
Description
Gets the specific property value from selected object.

Syntax

Code Function
get Lists all the properties that can be gained from the selected object.
get('property_name'); Gets the value of the property named 'property_name' from the selected object.
get('property_name', k); Gets the value of the property named 'property_name' from the k th selected object when multiple objects are selected. The objects are ordered by their location in object tree. The uppermost selected object is given the index 1, and the index numbers increase as you go down the tree.

Example

Add a new rectangle structure and rename it. Then select it and list all its properties that can be gained.

addrect;                       # add a rectangle structure
set('name', 'new_rectangle');  # rename

select('new_rectangle');
get                            # list all the properties that can be gained
get('type')                    # new_rectangle's type: Rectangle

Result:

val =
first rotation                 
first rotation axis            
index                          
material                       
mesh order                     
name                           
opacity                        
override default transparency  
override mesh order            
second rotation                
second rotation axis           
third rotation                 
third rotation axis            
use relative coordinate        
x                              
x max                          
x min                          
x pos                          
x span                         
y                              
y max                          
y min                          
y pos                          
y span                         
z                              
z max                          
z min                          
z pos                          
z span

Get x pos (m) of new_rectangle:

select('new_rectangle');
x_pos = get('x pos')        # get x pos (m) of new_rectangle

Result:

x_pos=
        0

See also
select, addrect, set

getnamed

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK · INTERCONNECT
Description
Gets the specific property value from named object.

Syntax

Code Function
getnamed('obj_name') Lists all the properties that can be gained from the object named 'obj_name' .
getnamed('obj_name', 'prop_name'); Gets the value of property 'prop_name' from the object named 'obj_name' .

Example
Example 1:

Add a rectangle in current simulation project and list all the names of properties that can be gained from it.

addrect;
set('name', 'new_rectangle');

getnamed('new_rectangle')

Result :

val =
first rotation                 
first rotation axis            
index                          
material                       
mesh order                     
name                           
opacity                        
override default transparency  
override mesh order            
second rotation                
second rotation axis           
third rotation                 
third rotation axis            
use relative coordinate        
x                              
x max                          
x min                          
x pos                          
x span                         
y                              
y max                          
y min                          
y pos                          
y span                         
z                              
z max                          
z min                          
z pos                          
z span             

Example 2:

addrect;
set('name', 'new_rectangle');

getnamed('new_rectangle', 'x')    # get x pos (m) of new_rectangle

Result :

val =
             0

See also
get

getunits

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Gets scale of the designated physical quantity to SI.

Syntax

Code Function
getunits('physical_quantity'); Gets the ratio of units used in the software to SI. The 'physical_quantity' can be ‘length' , 'time' , or 'frequency' .

Example

length_scale = getunits('length')

Result(the value of length_scale):

length_scale =
         1e-06

See also
get

getnumber

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Returns the number of selected objects in object tree.

Syntax

Code Function
getnumber Returns the number of selected objects in object tree.

Example

Add three objects and select them.

addpoly;
addrect;
addcircle;

selectall; # select three objects

getnumber

Result :

val =
             3

See also
select

getworkpath

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK · INTERCONNECT
Description
Gets the current work path.

Syntax

Code Function
getworkpath Gets the current work path.

See also
getprogrampath

getprogrampath

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Gets the current program path.

Syntax

Code Function
getprogrampath Gets the current program path.

See also
getworkpath

havedata

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Queries if the selected object(including solver, source, monitor, and analysis group) has the desired data.

Syntax

Code Function
havedata Lists all the datasets that the selected object has.
havedata('object_name', 'data_name'); Returns 1 if the object named 'object_name' has the data named 'data_name'.

Example
Select the FDFP monitor in FDTD, then run the following code.

havedata()

Result:

val =
E (vector: Ex, Ey, Ez )  
H (vector: Hx, Hy, Hz )  
P (vector: Px, Py, Pz )  
power                  
T

See also
havesweepoptdata

getdata

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Gets data from the selected object.

Syntax

Code Function
getdata Lists all the data that can be gained from the selected object.
getdata('object_name', 'data_name'); Gets the data named 'data_name' from the object called 'object_name' .
getdata(ID,'data_name'); Gets the data named 'data_name' from the object whose ID is ID .
getdata('object_name', 'dtset_name', 'data_name'); Gets the data named 'data_name' in the dataset called 'dtset_name' of the object called 'object_name' .
getdata(ID,'dtset_name', 'data_name'); Gets the data named 'data_name' in the dataset called 'dtset_name' of the object whose ID is ID .

Example
Get index_x data in the index dataset from the index monitor named 'Index Monitor' in FDTD.

getdata('FDTD::Index Monitor', 'index', 'index_x');

See also
get, select, dataset

getrawdata

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Gets raw data from the designated object.

Syntax

Code Function
getrawdata Lists all the raw data that can be gained from the selected object.
getrawdata('obj_name', 'data_name'); Gets raw data 'data_name' from the designated object named 'obj_name' .

Example

select('FDTD::FDFP Monitor');
getrawdata

Result:

val =
dx
dy
dz
f
lambda
simulation_dimension
simulation_type
spatial_type
x
y
z  

See also
getdata

getdataset

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Gets result from sources, monitors, or analysis-groups in the form of dataset.

Syntax

Code Function
getdataset('object_name', 'dataset_name') Gets the result named 'dataset_name' from the sources, monitors, or analysis-groups named 'object_name' in the form of dataset.

Example
Gets the electric field dataset from the FDFP Monitor named 'new_FPFP' of the Analysis Group in FDTD.

E_dtset = getdataset('FDTD::Analysis Group::new_FDFP', 'E');

See also
getdata

getsolverdata

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK
Description
Gets data in current solvers.

Syntax

Code Function
getsolverdata('solver_results'); Gets data in the current solver.

Example
Get the data named 'dimension' from the 3D FDTD solver.

dim=getsolverdata('dimension')

dim

Result:

dim =
             3

See also
getdata

getelectric

FDTD · FDFD · EME
Description
Gets square of the electric field amplitude from the designated monitor.

Syntax

Code Function
getelectric('monitor_name'); Gets square of the electric field amplitude from the monitor named 'monitor_name' .

Example
Gets square of the electric field amplitude from the FDFP monitor named 'Global Field' in FDTD.

E_mag = getelectric('FDTD::Global Field');

See also
getmagnetic

getmagnetic

FDTD · FDFD · EME
Description
Gets square of the magnetic field amplitude from the designated monitor.

Syntax

Code Function
getmagnetic('monitor_name'); Gets square of the magnetic field amplitude from the monitor named 'monitor_name' .

Example
Gets square of the magnetic field amplitude from the FDFP monitor named 'Global Field' in FDTD.

H_mag = getmagnetic('FDTD::Global Field');

See also
getelectric

getdipolepower

FDTD · FDFD
Description
Gets dipole power from the designated dipole source.

Syntax

Code Function
getdipolepower(lambda); Gets dipole power at the specified wavelength lambda (unit: m) from all the dipole sources.
getdipolepower(lambda, 'dipole_source_name'); Gets dipole power at the specified wavelength lambda (unit: m) from the designated dipole source.

See also
getsourcepower

getsourcepower

FDTD · FDFD
Description
Gets source power from the designated source.

Syntax

Code Function
getsourcepower(lambda); Gets the source power used to normalize transmission calculations at the wavelength (unit: m) points designated by the vector lambda from all sources.
getsourcepower(lambda, 'source_name') Gets the source power from the source named 'source_name' used to normalize transmission calculations at the wavelength (unit: m) points designated by the vector lambda .

Example
Get source power from the selected dipole source.

p = getsourcepower([1.55e-6; 1.2e-6], 'FDTD::Dipole Source');

See also
getsourceintensity, getsourcenorm

getsourceintensity

FDTD · FDFD
Description
Gets source intensity from the selected source.

Syntax

Code Function
getsourceintensity(lambda); Gets source intensity at the wavelength (unit: m) points designated by the vector lambda from all sources.
getsourceintensity(lambda, 'source_name'); Gets source intensity from the source named 'source_name' at the wavelength (unit: m ) points designated by the vector lambda .

Example
Get source intensity from the selected plane source.

I = getsourceintensity([1.55e-6; 1.2e-6], 'FDTD::Plane Source');

See also
getsourcepower, getsourcenorm

getsourcenorm

FDTD · FDFD
Description
Gets normalized spectrum from the selected source.

Syntax

Code Function
getsourcenorm(lambda); Gets normalization spectrum at the wavelength (unit: m) points designated by the vector lambda.
getsourcenorm(lambda, 'source_name'); Gets normalization spectrum at the wavelength (unit: m) points designated by the vector lambda , using the source named 'source_name'.

Example
Gets normalized spectrum using the plane source named 'Plane Source' in FDTD.

lambda = linspace(1.55, 1.65, 50);
source_norm = getsourcenorm(lambda.*1e-6, 'FDTD::Plane Source');

See also
getsourcepower, getsourceintensity

getsourcelist

FDTD · FDFD · EME

Description

Gets the information of sources in current simulation project.

Syntax

Code Function
ids = getsourcelist( 'id' ); Returns a 1 * N matrix named ids containing all the ids of sources in current simulation project. N is the number of sources.
names = getsourcelist( 'name' ); Returns a 1 * N matrix named names containing all the names of sources in current simulation project. N is the number of sources.
sourceInfo = getsourcelist(); Returns a 1 * N cell named sourceInfo consisting of structs. For each source, its information(id, name, visibility) will be stored in an independent struct as the element of the cell sourceInfo . N is the number of sources. For a specific source, if it is enabled, its visibility will be 1, otherwise its visibility will be 0.

Example

Example 1:

Gets all the information of sources in current simulation project.

sourceInfo = getsourcelist();

# display name, id, and visibility of specific source
printf( "source_name:%s\n", sourceInfo{1}.name );
printf( "source_id:%d\n", sourceInfo{1}.id );
printf( "source_visibility:%d\n", sourceInfo{1}.visibility );

Result:

source_name:Plane
source_id:3
source_visibility:1

Example 2:

Gets all the id numbers of sources in current simulation project.

ids = getsourcelist( 'id' );

ids 

Result:

ids =
             8             3             2

See also

getsourcepower, getsourceintensity, getsourcenorm

selectparent

FDTD · FDFD
Description
Selects the parent object of current object.

Syntax

Code Function
selectparent; Selects the parent object of current object. The function can only be used in analysis group or analysis data which has parent object.

See also
getparentdata

getparentdata

FDTD · FDFD
Description
Gets data in parent object.

Syntax

Code Function
getparentdata('data_name'); Gets the data named 'data_name' in parent object. The function can only be used in analysis group or analysis data which has parent object.

See also
selectparent

ishomogeneity

FDTD · FDFD
Description
Checks out whether the refractive index of the material is same as the index from index monitor.

Syntax

Code Function
ret = ishomogeneity(myname,index0,epsilon); Checks out whether the refractive index of the material index0 is same as the index from the index monitor named myname. If each element of abs(real(index - index0)) is smaller than 0.5* epsilon, returns 1, otherwise returns 0.
ret = ishomogeneity(myname,index0); Checks out whether the refractive index of the material index0 is same as the index from the index monitor named myname. In this case, the epsilon is 2.2205e-16 .
ret = ishomogeneity(myname); Checks out whether the refractive index of the material index0 is same as the index from the index monitor named myname. In this case, the index0 and epsilon are 1 and 2.2205e-16 respectively.

See also
getdata

getparameter

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK · INTERCONNECT
Description
Can get a list of all parameters and the value of a specified parameter. Supports both matrixdataset and unstructureddataset.

Syntax

Code Function
getparameter(dataset) or dataset.getparameter() Get a list of all parameters.
getparameter(dataset,'param') or dataset.getparameter('param') Get the value of the specified parameter.

Example

x=3;
y=4;
z=5;

mds=matrixdataset('abc');
mds.addparameter('p1',1:x,'p1_friend',1:x);
mds.addparameter('p2',1:y);
mds.addparameter('p3',1:z,'p4',1:z);

getparameter(mds)

mds.getparameter()

mds.getparameter('p1')

See also
addparameter, getattribute

getattribute

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK · INTERCONNECT
Description
Can get a list of all attributes and the value of a specified attribute. Supports both matrixdataset and unstructureddataset.

Syntax

Code Function
getattribute(dataset) or dataset.getattribute() Get a list of all attributes.
getattribute(dataset,'attr') or dataset.getattribute('attr') Get the value of the specified attribute.

Example

x = [-1;1;1;-1];
y = [-1;-1;1;1];
z = [0;0;0;0];
# point A; B; C; D;
C = [1,2,4;
    2,3,4];
# C is the connectivity matrix, each row contains three indices corresponding to the three vertices of a triangular face

Result=[1;2;3;4];
Result2 = [4;3;2;1];
uds = unstructureddataset('name',x,y,z,C);
uds.addparameter("f",1);
uds.addattribute("Result",Result);
uds.addattribute("Result2",Result2);

getattribute(uds)

uds.getattribute()

uds.getattribute('Result')

See also
addattribute, getparameter

getcommands

FDTD · FDFD · FDE · EME · FDCharge · RCWA · STACK · INTERCONNECT
Description
Lists all the script commands available in the current script workspace.

Syntax

Code Function
getcommands Lists all the script commands available in the current script workspace.

See also
get

Accessing data in sweep

havesweepoptdata

FDTD · FDFD · FDE · EME · FDCharge · RCWA
Description
Queries if the selected parameter sweep, optimization sweep, or S-Matrix sweep has the desired data.
For S-Matrix sweeps, only FDTD and EME are supported.

Syntax

Code Function
havesweepoptdata('sweep_name', 'data_name'); Returns 1 if the parameter sweep, optimization sweep, or S-Matrix sweep named 'sweep_name' has the data named 'data_name' .

See also
getsweep, havedata

getsweepoptdata

FDTD · FDFD · FDE · EME · FDCharge · RCWA

Description
Gets result from the parameter sweep, optimization or s-matrix sweep.
For S-Matrix sweeps, only FDTD and EME are supported.

Syntax

Code Function
getsweepoptdata('sweep_name', 'dataset_name') Gets the dataset named 'dataset_name' from the parameter sweep, optimization, or s-matrix named 'sweep_name' .
getsweepoptdata('sweep_name', 'dataset_name', 'data_name') Gets the data named 'data_name' in the dataset named 'dataset_name' of the designated parameter sweep, optimization, or s-matrix sweep.

Example
Get the data 'fom history' in the dataset 'fom history' from the optimization called 'new optimization'.

fom_history = getsweepoptdata('new_optimization', 'fom history', 'fom history');

See also
getdata, getsweep

Accessing data in EME

setemeanalysis

EME

Description

Sets parameters for the EME Analysis Window, such as sweep type, wavelength range, cell group span, and energy conservation settings.

Syntax

Code Function
setemeanalysis('parameter', value); Sets the specified parameter to the given value in the EME Analysis Window.

Example

setemeanalysis('start wavelength', 1.1e-6);
setemeanalysis('tolerance 1',0.002);

See also

set

getemeanalysis

EME
Description

Retrieves current parameter settings or results from the EME Analysis Window.

Syntax

Code Function
getemeanalysis('parameter'); Returns the value of the specified parameter (e.g., 'energy conservation', 'tolerance').

Example

energy_parameter = getemeanalysis('energy conservation');

See also

get

getemesweep

EME
Description

Obtains the sweep result data (e.g., S‑parameters) after running an emesweep task.

Syntax

Code Function
getemesweep('dataset_name'); Returns the dataset named 'dataset_name' from the most recent emesweep execution.

Example

S = getemesweep('S');
S_lambda = getemesweep('S_wavelength_sweep');

See also

emesweep, get

Accessing data in Interconnect

getports

INTERCONNECT
Description
Returns the ports of the specified element.

Syntax

Code Function
getports("element_name") Returns all the ports of the element named element_name.
getports("element_name", "data") Returns the ports of the specified data type.
getports("element_name", "", "type") Returns the ports of the specified port type.
getports("element_name", "data", "type") Returns the ports of the specified data type and port type.

The meanings of the parameters in the above tabulation are illustrated as following:

name type description
element_name string Name of the element.
data string Filters the port data type; an empty string means no restriction. Options are Optical signal (can be abbreviated as optical), Electrical signal (electrical), Digital signal (digital), and Electrical node.
type string Filters the port type. Options are Input, Output, Analyzer Input, and Bidirectional.

Example

getports("coupler_1")   # List all ports of an element.

Result:

val =
port 1
port 2
port 3
port 4

See also
addport

getresult

INTERCONNECT
Description
Gets result data from the specified element. Called without any argument, it lists the elements that contain results; called with an element name, it lists the results of that element. When a result name is also given, the result itself is returned in its original structure: a dataset remains a dataset, and a matrix remains a matrix.

Syntax

Code Function
getresult Lists the names of all elements that contain results in the current group scope and its nested elements. The names are returned as strings.
getresult("element_name") Lists all the results of the element named element_name. The hierarchy of each result is separated by "/". The names are returned as strings.
getresult("element_name", "result_name") Gets the result named result_name of the element named element_name. The result is returned in its original structure: a dataset remains a dataset, and a matrix remains a matrix.

Example 1
List all elements that contain results.

getresult

Result:

val =
Optical Network Analyzer

Example 2
Gets the result named input 1/mode 1/transmission of the element named Optical Network Analyzer.

T = getresult("Optical Network Analyzer", "input 1/mode 1/transmission")

Result:

T =
TE transmission vs frequency/wavelength

See also
getdata, getresultdata

getresultdata

INTERCONNECT
Description
Gets result data from the specified element. Unlike getresult, the result is converted to a matrix before it is returned.

Syntax

Code Function
getresultdata Lists the names of all elements that contain results in the current group scope and its nested elements. The names are returned as strings.
getresultdata("element_name") Lists all the results of the element named element_name. The hierarchy of each result is separated by "/". The names are returned as strings.
getresultdata("element_name", "result_name") Gets the result named result_name of the element named element_name. The result is returned as a matrix.

Example 1
List all elements that contain results.

getresultdata

Result:

val =
Optical Network Analyzer

Example 2
Gets the result named input 1/mode 1/transmission of the element named Optical Network Analyzer.

T = getresultdata("Optical Network Analyzer", "input 1/mode 1/transmission")

Result (not all results are listed here):

T =
  -0.0598284433 - 0.258910315i
  -0.0222852829 - 0.233997703i
  0.00774287155 - 0.205994552i
   0.0303836879 - 0.176525268i
...

See also
getresult, getdata