calculateModeVolume =================== This script calculates the mode volume based on epsilon and frequency snapshots generated by Bristol FDTD. This is a short guide. Please refer to the Matlab help for more up to date and detailed documentation:: help calculateModeVolume Example usage:: calculateModeVolume({'epsilon_snaphots.inp','frequency_snapshots.inp'}, 'eps_folder', '../epsilon', 'snap_plane', 'x', 'refractive_index_defect', 1.5); Using epsilon lookup tables:: calculateModeVolume({'sim.inp','sim.geo'}, 'epsilon_lookup_table', 'epsilon_1.prn', 'logfile_bool', true, 'logfile', 'MV_epsilon_1.log'); Format of an epsilon lookup table:: n f(n) 1 2.1 2 3 5 4 8 5 Arguments --------- ======================= ============================================================ Required arguments Description ======================= ============================================================ inpfile_list List of input files of the form {'file1.inp','file2.inp',...} ======================= ============================================================ ======================= ============================================================ Optional arguments Description ======================= ============================================================ fsnap_folder folder containing the .prn files for frequency snapshots. Default = '.' eps_folder folder containing the .prn files for epsilon snapshots. Default = '.' snap_plane direction of the snapshots ('x','y' or 'z'). Default = 'z' snap_time_number the number of the snapshot (i.e. 02 in zaaid02.prn for example). Default = biggest number for which snapshots are available. refractive_index_defect refractive index used to normalize the mode volume (usually refractive index of the defect/cavity). Default = 1. is_half_sim if set to true, the calculated mode volume will be multiplied by 2. Set to 'false' by default. numID_list List of numIDs of snapshots to allow selecting specific ones. However the chosen 'snap_plane' direction is still used for filtering, so a snapshot must be in the snap_plane direction and in numID_list to be selected! If not specified or empty, it defaults to a list of all numIDs. justCheck If true, the command only lists details about the snapshots that would be used to calculate the mode volume and does nothing else. Default = false. BFDTD_version BFDTD version used to create the snapshots. (affects the names of created files) Default = '2013'. mode_index Index of the mode for which to calculate the mode volume. Default = 1. Nmodes Total number of modes for which mode volume snapshots are available. Default = 1. (designed for snapshots created as follows: {(z1,f1), (z1,f2), (z2,f1), (z2,f2), (z3,f1), (z3,f2)}) logfile_bool If true log calculation info to a file in the fsnap_folder, else don't log. Default = false. incorrectAlgorithm_bool If true, use the incorrect mode volume calculation used in JQE paper. Only re-implemented for comparison purposes. Should always be left false otherwise! Default = false logfile Specify the name of the file to log to, if logfile_bool is true. If set to an empty string, a default name will be used. Default = '' integration_sphere Specify a spherical volume over which to integrate. Format: [xc,yc,zc,radius] where (xc,yc,zc) is the sphere centre and "radius" its radius. If radius<0, the whole volume is used. Default = '[0,0,0,-1]' epsilon_lookup_table Specify a file containing a lookup table to use for epsilon values. The file should be in the .prn format with 2 columns. ======================= ============================================================