Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 2.1 KB

README.md

File metadata and controls

18 lines (13 loc) · 2.1 KB

Lumerical Monte-Carlo simulation helper scripts

Helper scripts to generate Monte-Carlo simulations and analyse them for Lumerical FDTD.

Instructions

There are two scripts: monte_result.py and monte_generator.py. There is also an additional file config.ini. Most important note is make sure that all of these files remain in the same directory. Then the next important thing is the dependencies for these scripts. You need the following libraries to use these scripts:

  • numpy;
  • matplotlib;
  • shapely;
  • pandas;
  • geopandas.

Numpy and matplotlib you most likely will have already. The others can be installed with pip: pip install shapely pandas geopandas. Once these preliminary steps are done, the scripts should work.

The monte_result.py script is the one that collects the results from Monte-Carlo simulations and monte_generator.py is the script that generates the simulation files. The config.ini file is separated in to three sections: COMMON, MONTE_GENERATION and MONTE_ANALYSIS. The COMMON section sets parameters that are common for both scripts. The other two set parameters to their corresponding scripts.

To run the monte_result.py script, first place your Monte-Carlo simulation files in some directory and make sure they are named something like name{number}.py_ (most important is that a number follows the underscore). Then open the config file and set filepath parameter to the directory where the simulation files are kept in. Then set the output file path and name if you would like and run the script.

To run the monte_generator.py script, first you will need an already set up simulation file with a source, structure, monitors and etc. After that set the filepath for where the base structure simulation file is located. Then set up the various parameters that are described in the comments of the config file and then you can run the script. Once you run the script, a plot window will show up showing where your random points will be located. If you want the script to continue to generate the files, close the plot window and it will. If this is unnecessary, line 84 can be commented out.