Writes a dataset into a Zemax .zbf2 file in the specified directory.
| Syntax | Description |
|---|---|
| zbf2write("filename", zbf2_data_struct); | Writes a zbf2 file to a path specified by filename, with the data in zbf2_data_struct. The data to include in the struct is discussed below. This function does not return any data. |
The data struct must contain the following fields
| Field | Description |
|---|---|
| beam |
A dataset containing beam information. This dataset must contain E vs x,y, and wavelength/frequency information. Note: Only the keyword wavelength and frequency are accepted. |
| index | The refractive index for the beam. |
| attributeName | Optional, a string that specifies the name of the field information in the beam dataset. Defaults to using the first scalar or vector attribute in the dataset. |
| rotation_matrix | Optional, a matrix specifies the rotation matrix. Defaults to using the identity matrix. |
| position | Optional, a vector that specifies the position of the beam. Defaults to [0,0,0]. |
| OPL | Optional, optical path length. Defaults to 0. |
Example
# Write beam information to the current working directory
E=getresult("monitor","E");
my_zbf2_struct=struct;
my_beam = rectilineardataset("beam",E.x, E.y, E.z);
my_beam.addparameter("wavelength",E.lambda,"frequency", E.f);
my_beam.addattribute("E",E.E);
my_zbf2_struct.beam=my_beam;
my_zbf2_struct.index=1;
zbf2write("my_beam.zbf2", my_zbf2_struct);
See Also