Changes

Glossary of EM.Cube's Python Functions

3,993 bytes added, 22:22, 11 June 2018
<table>
<tr>
<td>[[image:Cube-icon.png | link=Getting_Started_with_EM.Cube]] [[image:cad-ico.png | link=Building_Geometrical_Constructions_in_CubeCAD]] [[image:fdtd-ico.png | link=EM.Tempo]] [[image:prop-ico.png | link=EM.Terrano]] [[image:static-ico.png | link=EM.Ferma]] [[image:planar-ico.png | link=EM.Picasso]] [[image:metal-ico.png | link=EM.Libera]] [[image:po-ico.png | link=EM.Illumina]]</td>
<tr>
</table>
[[Image:Back_icon.png|30px]] '''[[EM.Cube | Back to EM.Cube Main Page]]'''
<br />
 
== Standard Python Operators ==
|}
== Standard Basic Mathematical Python Functions ==
{| class="wikitable"
| Hyperbolic tangent function
| -
|-
| np.floor(x)
| Std. Python function
| Floor function
| nearest integer <= x
|-
| np.arcsinh(x)
| Inverse hyperbolic tangent function
| -
|-
| np.floor(x)
| Std. Python function
| Floor function
| nearest integer <= x
|}
|}
== EM.Cube's Miscellaneous Native Python Functions == {| class="wikitable"!scope="col"| Syntax!scope="col"| Type!scope="col"| Description!scope="col"| Notes|-| style="width:80px;" | rect(x)| style="width:150px;" | EMAG Python function| style="width:270px;" | Rectangle function| style="width:270px;" | 1 if |x|&le;0.5, 0 elsewhere |-| tri(x)| EMAG Python function| Triangle function| 1 if |1-x|&le;1, 0 elsewhere |-| spline2(x)| EMAG Python function| Quadratic spline function| -|-| spline3(x)| EMAG Python function| Cubic spline function| -|-| step(x)| EMAG Python function| Step function| 1 if x>0, 0 if x<0|-| sgn(x)| Std. Python function| Sign function| 1 if x>0, -1 if x<0|-| ramp(x)| EMAG Python function| Ramp function| x if x>0, 0 if x<0|-| sqr_wave(x)| EMAG Python function| Square wave function| -|-| tri_wave(x)| EMAG Python function| Triangle wave function| -|-| sawtooth(x)| EMAG Python function| Sawtooth wave function| -|-| sinc(x)| EMAG Python function| Sinc function| sin(pi*x)/(pi*x)|-| gauss(x,mu,sigma)| EMAG Python function| Gaussian function of mean mu and standard deviation sigma| exp(-0.5*((x-mu)/sigma)**2)/sigma/sqrt(2*pi)|-| msin(x,r)| EMAG Python function| super-quadratic sine function of order r| -|-| mcos(x,r)| EMAG Python function| super-quadratic cosine function of order r| -|-| sigmoid(x,a)| EMAG Python function| Sigmoid function of slope a| 2/(1 + exp(-a*x)) - 1|-| bh_window(x,T)| EMAG Python function| Blackman-Harris window function| -|-| bh_step(x,T)| EMAG Python function| Blackman-Harris step function| -|-| rand(x,y)| EMAG Python function| Random function| -|-| rosen(x,y,a,b)| EMAG Python function| Rosenbrock function| (a-x)**2 + b*(y-x**2)**2|-| mean(x,y)| EMAG Python function| arithmetic mean of x and y| 0.5*(x+y)|-| geo(x,y)| EMAG Python function| geometric mean of x and y| sqrt(x*y)|-| harm(x,y)| EMAG Python function| harmonic mean of x and y| 2/(1/x+1/y)|-| sqr2(x,y)| EMAG Python function| sum of squares of x and y| x**2 + y**2|-| sqr3(x,y,z)| EMAG Python function| sum of squares of x and y and z| x**2 + y**2 + z**3|-| sqrt2(x,y)| EMAG Python function| radius of 2D point (x,y)| sqrt(x**2 + y**2)|-| sqrt3(x,y,z)| EMAG Python function| radius of 3D point (x,y,z)| sqrt(x**2 + y**2 + z**3)|} == EM.Cube's Design Python Functions == {| class="wikitable"!scope="col"| Syntax!scope="col"| Type!scope="col"| Description!scope="col"| Notes|-| style="width:100px;" | microstrip_design(z0,er)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the width-to-height ratio of a microstrip transmission line | style="width:250px;" | z0: characteristic impedance in Ohms, er: substrate permittivity|-| style="width:100px;" | microstrip_z0(w,h,er)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the characteristic impedance of a microstrip transmission line in Ohms | style="width:250px;" | w: microstrip width, h: substrate height, er: substrate permittivity|-| style="width:100px;" | microstrip_eps_eff(w,h,er)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the effective permittivity of a microstrip transmission line | style="width:250px;" | w: microstrip width, h: substrate height, er: substrate permittivity|-| style="width:100px;" | microstrip_lambda_g(w,h,er,freq_hertz)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the guide wavelength of a microstrip transmission line in meters| style="width:250px;" | w: microstrip width, h: substrate height, er: substrate permittivity, freq_hertz: frequency in Hz|-| style="width:100px;" | cpw_design_w(z0,s,h,er)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the slot width of a coplanar waveguide (CPW) transmission line | style="width:250px;" | z0: characteristic impedance in Ohms, s: center strip width (or slot spacing), h: substrate height, er: substrate permittivity|-| style="width:100px;" | cpw_design_s(z0,w,h,er)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the center strip width (or slot spacing) of a coplanar waveguide (CPW) transmission line | style="width:250px;" | z0: characteristic impedance in Ohms, w: slot width, h: substrate height, er: substrate permittivity|-| style="width:100px;" | coaxial_design(z0,er)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the ratio of radius of the outer conductor to the radius of the inner conductor of a coaxial transmission line | style="width:250px;" | z0: characteristic impedance in Ohms, er: core permittivity|-| style="width:100px;" | waveguide_design(er,freq_hertz)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the minimum larger dimension in meter of the cross section of a hollow rectangular waveguide above cutoff | style="width:250px;" | er: filling permittivity, freq_hertz: frequency in Hz|-| style="width:100px;" | horn_design_a(D0_dB,a_lambda,b_lambda)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the wavelength-normalized larger dimension of the aperture of an optimal pyramidal horn antenna | style="width:250px;" | D0_dB: directivity d, a_lambda: wavelength-normalized larger dimension of the feed waveguide, b_lambda: wavelength-normalized smaller dimension of the feed waveguide |-| style="width:100px;" | horn_design_b(D0_dB,a_lambda,b_lambda)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the wavelength-normalized smaller dimension of the aperture of an optimal pyramidal horn antenna | style="width:250px;" | D0_dB: directivity d, a_lambda: wavelength-normalized larger dimension of the feed waveguide, b_lambda: wavelength-normalized smaller dimension of the feed waveguide |-| style="width:100px;" | horn_design_l(D0_dB,a_lambda,b_lambda)| style="width:150px;" | EMAG Python function| style="width:250px;" | Returns the wavelength-normalized length of an optimal pyramidal horn antenna | style="width:250px;" | D0_dB: directivity d, a_lambda: wavelength-normalized larger dimension of the feed waveguide, b_lambda: wavelength-normalized smaller dimension of the feed waveguide |} == EM.Cube's Python Functions for Geometric Object Creation ==
====activate====
EXAMPLE: ''activate("Color_1")''
DESCRIPTION: Activates a color, material or object group in the current active [[EM.Cube]] modulefor insertion of new objects.
====add_variable====
DESCRIPTION: Creates a base point set in [[EM.Terrano]]. If the base point set group 'label' already exists, the group is activated.
 
====bh_step====
 
SYNTAX: bh_step({{ArgTypeReal}} x, {{ArgTypeReal}} T)
 
EXAMPLE: ''bh_step(0.5,1)''
 
DESCRIPTION: Computes and returns the Blackman-Harris step function.
 
====bh_window====
 
SYNTAX: bh_window({{ArgTypeReal}} x, {{ArgTypeReal}} T)
 
EXAMPLE: ''bh_window(0.5,1)''
 
DESCRIPTION: Computes and returns the Blackman-Harris window function.
====box====
DESCRIPTION: Sets the open/close state of a polyline or NURBS curve. Use 0 for open curve and 1 for close curve.
 
====coaxial_design====
 
SYNTAX: coaxial_design({{ArgTypeReal}} z0, {{ArgTypeReal}} er)
 
EXAMPLE: ''coaxial_design(50,2.2)''
 
DESCRIPTION: Computes and returns the ratio of the radius of the outer conductor to the radius of the inner conductor of a coaxial transmission line of characteristic impedance z0 (in Ohms) with core relative permittivity er.
====coaxial_src====
DESCRIPTION: Consolidates a specified object.
 
====cpw_design_s====
 
SYNTAX: cpw_design_s({{ArgTypeReal}} z0, {{ArgTypeReal}} w, {{ArgTypeReal}} h, {{ArgTypeReal}} er)
 
EXAMPLE: ''cpw_design_s(50,2,0.5,2.2)''
 
DESCRIPTION: Computes and returns the center strip width (in meters) of a CPW transmission line of characteristic impedance z0 with slot width w, substrate height h and substrate relative permittivity er.
 
====cpw_design_w====
 
SYNTAX: cpw_design_w({{ArgTypeReal}} z0, {{ArgTypeReal}} s, {{ArgTypeReal}} h, {{ArgTypeReal}} er)
 
EXAMPLE: ''cpw_design_w(50,1,0.5,2.2)''
 
DESCRIPTION: Computes and returns the slot width (in meters) of a CPW transmission line of characteristic impedance z0 with center strip width s, substrate height h and substrate relative permittivity er.
====cpw_src====
DESCRIPTION: Sets the freeze state of an object (0/1).
 
====gauss====
 
SYNTAX: gauss({{ArgTypeReal}} x, ArgTypeReal}} mu, ArgTypeReal}} sigma)
 
EXAMPLE: ''gauss(0.5,0,1)''
 
DESCRIPTION: Computes and returns the Gaussian function of mean mu and standard deviation sigma: exp(-0.5*((x-mu)/sigma)**2)/sigma/sqrt(2*pi).
====gauss_beam====
DESCRIPTION: Creates a Gaussian beam source in [[EM.Tempo]]. If the Gaussian beam source 'label' already exists, its properties are modified.
 
====generate_input_files====
 
SYNTAX: generate_input_files()
 
EXAMPLE: ''generate_input_files()''
 
DESCRIPTION: Generates all the input files for the simulation engine of the current module without running a simulation.
 
====geo====
 
SYNTAX: geo({{ArgTypeReal}} x, {{ArgTypeReal}} y)
 
EXAMPLE: ''geo(1,2)''
 
DESCRIPTION: Computes and returns the geometric mean of x and y: sqrt(x*y).
====get_area====
DESCRIPTION: Groups a number of objects into a composite object with the given label.
 
====harm====
 
SYNTAX: harm({{ArgTypeReal}} x, {{ArgTypeReal}} y)
 
EXAMPLE: ''harm(1,2)''
 
DESCRIPTION: Computes and returns the harmonic mean of x and y: 2/(1/x+1/y).
====helix====
EXAMPLE: ''helix("Helix_1",0,0,0,15,15,10,0)''
DESCRIPTION: Draws a helical curve in the project workspace under the currently activated material group node, or modifies the helix named 'label' if it already exists. The parameter "radius_inner" specifies the helix's radius at the beginning of the helix, and radius_outer specifies the radius at the end of the helix. If the Boolean parameter "helixl_dir" is 1, the helical curve will be drawn counter-clockwise. ====horn_design_a==== SYNTAX: horn_design_a({{ArgTypeReal}} D0_dB, {{ArgTypeReal}} a_lambda, {{ArgTypeReal}} b_lambda) EXAMPLE: ''horn_design_a(15,0.4,0.3)'' DESCRIPTION: Computes and returns the wavelength-normalized larger dimension of the aperture of an optimal pyramidal horn antenna with directivity D0_dB and wavelength-normalized feed waveguide dimensions a_lambda and b_lambda. ====horn_design_b==== SYNTAX: horn_design_b({{ArgTypeReal}} D0_dB, {{ArgTypeReal}} a_lambda, {{ArgTypeReal}} b_lambda) EXAMPLE: ''horn_design_b(15,0.4,0.3)'' DESCRIPTION: Computes and returns the wavelength-normalized smaller dimension of the aperture of an optimal pyramidal horn antenna with directivity D0_dB and wavelength-normalized feed waveguide dimensions a_lambda and b_lambda. ====horn_design_l==== SYNTAX: horn_design_l({{ArgTypeReal}} D0_dB, {{ArgTypeReal}} a_lambda, {{ArgTypeReal}} b_lambda) EXAMPLE: ''horn_design_l(15,0.4,0.3)'' DESCRIPTION: Computes and returns the wavelength-normalized length of an optimal pyramidal horn antenna with directivity D0_dB and wavelength-normalized feed waveguide dimensions a_lambda and b_lambda.
====huygens_src====
DESCRIPTION: Creates a permanent magnet source group in [[EM.Ferma]]. If the magnet group 'label' already exists, the group is activated.
 
====mcos====
 
SYNTAX: mcos({{ArgTypeReal}} x, {{ArgTypeReal}} r)
 
EXAMPLE: ''mcos(0.5,2)''
 
DESCRIPTION: Computes and returns the super-quadratic cosine function of order r.
 
====mean====
 
SYNTAX: mean({{ArgTypeReal}} x, {{ArgTypeReal}} y)
 
EXAMPLE: ''mean(1,2)''
 
DESCRIPTION: Computes and returns the arithmetic mean of x and y: 0.5*(x+y).
====merge_curve====
DESCRIPTION: Generates and displays the mesh of the physical structure.
 
====microstrip_design====
 
SYNTAX: microstrip_design({{ArgTypeReal}} z0, {{ArgTypeReal}} er)
 
EXAMPLE: ''microstrip_design(50,2.2)''
 
DESCRIPTION: Computes and returns the width-to-height ratio of a microstrip transmission line with characteristic impedance z0 in Ohms and substrate relative permittivity er.
 
====microstrip_eps_eff====
 
SYNTAX: microstrip_eps_eff({{ArgTypeReal}} w, {{ArgTypeReal}} h, {{ArgTypeReal}} er)
 
EXAMPLE: ''microstrip_eps_eff(2,0.5,2.2)''
 
DESCRIPTION: Computes and returns the effective permittivity of a microstrip transmission line with width w, substrate height h and substrate relative permittivity er.
 
====microstrip_lambda_g====
 
SYNTAX: microstrip_lambda_g({{ArgTypeReal}} w, {{ArgTypeReal}} h, {{ArgTypeReal}} er, {{ArgTypeReal}} freq_hertz)
 
EXAMPLE: ''microstrip_lambda_g(2,0.5,2.2,2e9)''
 
DESCRIPTION: Computes and returns the guide wavelength (in meters) of a microstrip transmission line with width w, substrate height h and substrate relative permittivity er at an operating frequency of freq_hertz.
====microstrip_src====
DESCRIPTION: Creates a microstrip port source in [[EM.Tempo]]. If the microstrip port 'label' already exists, its properties are modified.
 
====microstrip_z0====
 
SYNTAX: microstrip_z0({{ArgTypeReal}} w, {{ArgTypeReal}} h, {{ArgTypeReal}} er)
 
EXAMPLE: ''microstrip_z0(2,0.5,2.2)''
 
DESCRIPTION: Computes and returns the characteristic impedance (in Ohms) of a microstrip transmission line with width w, substrate height h and substrate relative permittivity er.
 
====microstrip_zoc====
 
SYNTAX: microstrip_zoc({{ArgTypeReal}} w, {{ArgTypeReal}} l, {{ArgTypeReal}} h, {{ArgTypeReal}} er, {{ArgTypeReal}} freq_hertz)
 
EXAMPLE: ''microstrip_zoc(2,25,0.5,2.2,2e9)''
 
DESCRIPTION: Computes and returns the input reactance (in Ohms) of an open-circuited microstrip transmission line with width w, length l, substrate height h and substrate relative permittivity er at an operating frequency of freq_hertz.
 
====microstrip_zsc====
 
SYNTAX: microstrip_zsc({{ArgTypeReal}} w, {{ArgTypeReal}} l, {{ArgTypeReal}} h, {{ArgTypeReal}} er, {{ArgTypeReal}} freq_hertz)
 
EXAMPLE: ''microstrip_zsc(2,25,0.5,2.2,2e9)''
 
DESCRIPTION: Computes and returns the input reactance (in Ohms) of a short-circuited microstrip transmission line with width w, length l, substrate height h and substrate relative permittivity er at an operating frequency of freq_hertz.
====mirror====
DESCRIPTION: Transfers an object from its current material/object group node in the navigation tree to another node or optionally to another [[EM.Cube]] module.
 
====msin====
 
SYNTAX: msin({{ArgTypeReal}} x, {{ArgTypeReal}} r)
 
EXAMPLE: ''msin(0.5,2)''
 
DESCRIPTION: Computes and returns the super-quadratic sine function of order r.
====nurbs_curve====
DESCRIPTION: Rail-sweeps the specified sweep object along the specified curve object.
 
====ramp====
 
SYNTAX: ramp({{ArgTypeReal}} x)
 
EXAMPLE: ''ramp(0.5)''
 
DESCRIPTION: Computes and returns the ramp function: x if x>0, 0 if x<0.
 
====rand====
 
SYNTAX: rand({{ArgTypeReal}} x, {{ArgTypeReal}} y)
 
EXAMPLE: ''rand(0,1)''
 
DESCRIPTION: Computes and returns a random number between x and y using an uniform distribution.
====random_group====
DESCRIPTION: Creates a receiver set in [[EM.Terrano]]. If the receiver set 'label' already exists, its properties are modified.
 
====rect====
 
SYNTAX: rect({{ArgTypeReal}} x)
 
EXAMPLE: ''rect(0.1)''
 
DESCRIPTION: Computes and returns the rectangular window function: 1 if x<0.5, 0 elsewhere.
====rect_gap_src====
DESCRIPTION: Creates or modifies a revolution object from a specified object. If modifying an existing revolution object, the pre-existing primitive object is used. (x0,y0,z0) specifies the center of revolution, and (uX,uY,uZ) specifies the revolution axis. The revolution angle "rot_angle" is given in degrees.
 
====rosen====
 
SYNTAX: rosen({{ArgTypeReal}} x, {{ArgTypeReal}} y, {{ArgTypeReal}} a, {{ArgTypeReal}} b)
 
EXAMPLE: ''rosen(0.5,0,1,2)''
 
DESCRIPTION: Computes and returns the Rosenbrock function: (a-x)**2 + b*(y-x**2)**2.
====rotate====
DESCRIPTION: Saves [[EM.Cube]]'s output simulation data files under the specified directory.
 
====sawtooth====
 
SYNTAX: sawtooth({{ArgTypeReal}} x)
 
EXAMPLE: ''sawtooth(0.5)''
 
DESCRIPTION: Computes and returns the ascending periodic sawtooth function of period T = 2, oscillating between two values +1 and -1 and having a zero value of at x = 0.
====scale====
DESCRIPTION: Sets [[EM.Cube]]'s project length units.
 
====sgn====
 
SYNTAX: sgn({{ArgTypeReal}} x)
 
EXAMPLE: ''sgn(-1.0)''
 
DESCRIPTION: Computes and returns the signum function: 1 if x>0, -1 if x<0.
====short_dipole====
DESCRIPTION: Creates a Hertzian short dipole source. If the short dipole source 'label' already exists, its properties are modified.
 
====sigmoid====
 
SYNTAX: sigmoidnc({{ArgTypeReal}} x, {{ArgTypeReal}} a)
 
EXAMPLE: ''sigmoid(0.5,1)''
 
DESCRIPTION: Computes and returns the sigmoid function of slope a: 2/(1 + exp(-a*x)) - 1.
 
====sinc====
 
SYNTAX: sinc({{ArgTypeReal}} x)
 
EXAMPLE: ''sinc(0.5)''
 
DESCRIPTION: Computes and returns the sinc function: sin(pi*x)/(pi*x).
====slice====
DESCRIPTION: Applies spline fit transformation on a specified polymesh, polyline or polystrip object.
 
====spline2====
 
SYNTAX: spline2({{ArgTypeReal}} x)
 
EXAMPLE: ''spline2(1.0)''
 
DESCRIPTION: Computes and returns the quadratic B-spline function.
 
====spline3====
 
SYNTAX: spline3({{ArgTypeReal}} x)
 
EXAMPLE: ''spline3(1.0)''
 
DESCRIPTION: Computes and returns the cubic B-spline function.
 
====sqr_wave====
 
SYNTAX: sqr_wave({{ArgTypeReal}} x)
 
EXAMPLE: ''sqr_wave(0.5)''
 
DESCRIPTION: Computes and returns the periodic square wave function of period T = 2, oscillating between two values +1 and -1 and having a value of +1 at x = 0.
 
====sqr2====
 
SYNTAX: sqr2({{ArgTypeReal}} x, {{ArgTypeReal}} y)
 
EXAMPLE: ''sqr2(0,1)''
 
DESCRIPTION: Computes and returns the sum of squares of x and y: x**2 + y**2.
 
====sqr3====
 
SYNTAX: sqr2({{ArgTypeReal}} x, {{ArgTypeReal}} y, {{ArgTypeReal}} z)
 
EXAMPLE: ''sqr2(0,1,2)''
 
DESCRIPTION: Computes and returns the sum of squares of x, y and z: x**2 + y**2 + z**2.
 
====sqrt2====
 
SYNTAX: sqrt2({{ArgTypeReal}} x, {{ArgTypeReal}} y)
 
EXAMPLE: ''sqrt2(0,1)''
 
DESCRIPTION: Computes and returns the radius of the 2D point (x,y): sqrt(x**2 + y**2).
 
====sqrt3====
 
SYNTAX: sqrt3({{ArgTypeReal}} x, {{ArgTypeReal}} y, {{ArgTypeReal}} z)
 
EXAMPLE: ''sqrt3(0,1,2)''
 
DESCRIPTION: Computes and returns the radius of the 3D point (x,y,z): sqrt(x**2 + y**2 + z**2).
 
====step====
 
SYNTAX: step({{ArgTypeReal}} x)
 
EXAMPLE: ''step(1.0)''
 
DESCRIPTION: Computes and returns the unit step function: 1 if x>0, 0 if x<0.
====strip_sweep====
DESCRIPTION: Creates a transmitter set in [[EM.Terrano]]. If the transmitter set 'label' already exists, its properties are modified.
 
====tri====
 
SYNTAX: tri({{ArgTypeReal}} x)
 
EXAMPLE: ''tri(0.1)''
 
DESCRIPTION: Computes and returns the triangular window function: 1-|x| if x<1, 0 elsewhere.
 
====tri_wave====
 
SYNTAX: tri_wave({{ArgTypeReal}} x)
 
EXAMPLE: ''tri_wave(0.5)''
 
DESCRIPTION: Computes and returns the periodic triangular wave function of period T = 2, oscillating between two values +1 and -1 and having a value of +1 at x = 0.
====triangle_strip====
DESCRIPTION: Creates a scattering wave port source in [[EM.Picasso]] or [[EM.Libera]]. If the wave port 'label' already exists, its properties are modified.
 
====waveguide_design====
 
SYNTAX: waveguide_design({{ArgTypeReal}} er, {{ArgTypeReal}} freq_hertz)
 
EXAMPLE: ''waveguide_design(1.0,2e9)''
 
DESCRIPTION: Computes and returns the minimum larger dimension (in meters) of the cross section of a hollow rectangular waveguide above cutoff with a material filling of relative permittivity er at an operating frequency of freq_hertz.
====waveguide_src====
<hr>
[[Image:Top_icon.png|48px30px]] '''[[#Standard Python Functions Standard_Python_Operators | Back to the Top of the Page]]'''
[[Image:Back_icon.png|40px30px]] '''[[EM.Cube | Back to EM.Cube Main Page]]'''
28,333
edits