# API Reference¶

## Simulation¶

 Simulation(size[, center, resolution, …]) Main class for building a simulation model. Simulation.materials List containing all materials included in the simulation. Simulation.structures List containing all Structure objects. Simulation.sources List containing all Source objects. Simulation.monitors List containing all Monitor objects. Simulation.epsilon([monitor, center, size, …]) Compute the complex relative permittivity inside a volume. Simulation.set_time([run_time, courant]) Change the value of the run time of the simulation and the time step determined by the courant stability factor.

 Simulation.load_results(dfile[, ind_src_norm]) Load all monitor data recorded from a Tidy3D run. Return a dictionary with all simulation parameters and objects. Export the simulation specification to a JSON file. Import a simulation specification from a JSON file.

## Material¶

 Medium([name]) Base class for a custom defined material. Medium.epsilon([freqs]) Evaluate the (complex) relative permittivity of the medium. PEC Perfect electric conductor.
 material_library A library of pre-defined materials.

### Dispersive models¶

 Sellmeier(coeffs[, name]) Sellmeier dispersion refractive index model. Lorentz(eps_inf, coeffs[, name]) Lorentz dispersion permittivity model. Debye(eps_inf, coeffs[, name]) Debye dispersion permittivity model.

## Structure¶

 Structure(material[, name]) Base class for regions defined by geometric shapes in a simulation domain. Box(center, size, material[, name]) Box structure, i.e. Sphere(center, radius, material[, name]) Sphere structure. Cylinder(center, axis, radius, height, material) Cylinder structure. PolySlab(material, vertices[, z_cent, …]) A structure defined as polygon in x and y, and extruded in z. GdsSlab(material, gds_cell[, gds_layer, …]) A structure defined through a GDS cell imported through gdspy.

## Source¶

 Source(source_time, span[, amplitude, name]) Base class for defining spatial profiles of excitation conditions. VolumeSource(source_time, center, size, …) A source specified as an electric or a magnetic current of a fixed component (one of Ex, Ey, Ez, Hx, Hy, Hz) with a constant amplitude inside a 3D volume region. PointDipole(source_time, center, component) A source specified as an electric or a magnetic current of a fixed component (one of Ex, Ey, Ez, Hx, Hy, Hz) at a given point. ModeSource(source_time, center, size[, …]) Eigenmode source spanning a 2D cross section of a given size inside a Simulation. PlaneWave(source_time, injection_axis, …) Plane-wave source with a specified direction and polarization, spanning the whole 2D simulation cross-section at a given position normal to a given injection axis.

### Time dependence¶

 Base class for the time dependence of a source. GaussianPulse(frequency, fwidth[, offset, phase]) Source with a Gaussian-envelope time dependence.

### Simulation operations¶

 Simulation.compute_modes(mode_object, Nmodes) Compute the eigenmodes of the 2D cross-section of a ModeSource or ModeMonitor object, assuming translational invariance in the third dimension. Simulation.set_mode(source, mode_ind[, …]) Set the index of the mode to be used by the mode source. Simulation.spectrum(source, freqs) Returns the spectrum of a Source.

## Monitor¶

 Monitor(center, size, store[, name]) Base class for defining field monitors. TimeMonitor(center, size[, t_start, t_stop, …]) Monitor recording the time-domain fields within a 3D region. FreqMonitor(center, size, freqs[, store, name]) Monitor recording a discrete Fourier transform of the fields within a 3D region, for a given list of frequencies. ModeMonitor(center, size, freqs[, Nmodes, name]) FreqMonitor subclass defining a 2D plane in which the recorded frequency-domain fields can be decomposed into propagating eigenmodes.

### Simulation operations¶

 Simulation.data(monitor) Return a dictionary with all the stored data in a Monitor. Simulation.flux(monitor[, normal]) Compute the area-integrated Poynting flux in a given direction. Simulation.poynting(monitor) Compute the Poynting vector at every point recorded by a Monitor. Simulation.decompose(mode_monitor) Compute the decomposition of the fields recorded in a ModeMonitor into the eigenmodes in the monitor plane. Simulation.compute_modes(mode_object, Nmodes) Compute the eigenmodes of the 2D cross-section of a ModeSource or ModeMonitor object, assuming translational invariance in the third dimension. Simulation.set_monitor_modes(monitor[, …]) Set the number Nmodes of modes with effective index closest to target_neff to be used in the modal decomposition in the monitor.

## Near Field to Far Field¶

 Near2Far(monitor_data[, freq_index]) Near field to far field transformation tool. Get fields at a point relative to monitor center in cartesian coordintes. Near2Far.get_fields_spherical(r, theta, phi) Get fields at a point relative to monitor center in spherical coordintes. Get power scattered to a point relative to monitor center in cartesian coordinates. Near2Far.get_power_spherical(r, theta, phi) Get power scattered to a point relative to monitor center in spherical coordinates. Near2Far.get_radar_cross_section(theta, phi) Get radar cross section at a point relative to monitor center in units of incident power.

## Plotting tools¶

 Simulation.viz_eps_2D([normal, position, …]) Plot the real part of the relative permittivity distribution of a 2D cross-section of the simulation. Simulation.viz_source(source[, axs]) Plot both the time and frequency dependence of a source. Simulation.viz_source_time(source[, ax]) Plot the time dependence of a source. Simulation.viz_source_spectrum(source[, ax, …]) Plot the frequency dependence of a source. Simulation.viz_field_2D(monitor[, …]) Plot a 2D cross-section of a field stored in a Monitor. Simulation.viz_modes(mode_obj[, freq_ind, …]) Plot the field distribution of the 2D eigenmodes of a ModeSource or a ModeMonitor object.

## Web API¶

 web.new_project(sim_dict[, task_name, …]) Create new project. web.get_project(task_id) Get all project details from a given task_id. web.delete_project(task_id) Delete a project from a given task_id. web.monitor_project(task_id) Monitor the status of a given project every second. web.list_projects([Nprojects]) Print a summary of all projects of the current user, in chronological order of submission. web.download_json(task_id[, target_folder]) Download the project json file web.download_results(task_id[, target_folder]) Download the results of a solver run, including the json file defining the simulation, a single file containing all the monitor data, and a log file. web.run(simulation[, task_name, …]) Runs a simulation and loads the results. web.load(task_id[, simulation, target_folder]) Loads results from web to simulation.

## Miscellaneous¶

 dft_spectrum(time_series, dt, freqs) Computes the frequency spectrum associated to a time series directly using the discrete fourier transform. Set the default logging configuration. logging_file(fname[, filemode, level]) Set a file to write log to, independently from the stdout and stderr output chosen using logging_level(). logging_level(level) Set the lowest severity level to print to the console, as per the python logger.