Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.


Suite of python codes to perform analysis of MECSim results and automated scripting of MECSim runs (./MECSim_win7.exe)

Note that you should always run a single MECSim on a roughly correct value set to ensure that the curve looks correct. For example too low resolution may lead to spurious spikes in the current. There are warnings in the MECSim output that guide the user to finding these or that abort when criteria for numerical stability are not met. Best to go through this before automation - machines can not do everything... yet.

Analysis codes

Jupyter notebooks in python


Scripting codes

The python script file "GenerateScript.ipynb" will create "Settings"

The two analysis codes are called in non-interactive mode inside the generated script.


  1. Edit file to have variables (e.g. $Ru and $Cap0)
  2. Edit GenerateScript to setup the range of variables by assigning x=$Ru and y=$Cap0 for example
  3. Run GenerateScript to create the parameters file "Settings.inp" and bash script ""
  4. Run the bash script which will do the following:
    • run all combinations of the variables through MECSim
    • run the MECSim output file "MECSimOutput_Pot.txt" through the "HarmonicSplitter" code to split by harmonics and create smoothed currents against time
    • run the smoothed current file through "CompareSmoothed" code to generate a least squares comparison for each harmonic and output a single metric
    • the metric comparison value is added to the grid output file typically called "results.txt" which also contains the variable parameters
  5. Run the "SurfacePlots" interactive script to examine or produce output images of the grid results

Docker instructions

Once the docker is running the last lines will be similar to:

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:

Follow the instructions.

Known issues

Docker for windows 10


docker run -v C:\Repos\MECSim_Analytics/input:/usr/local/input -v C:\Repos\MECSim_Analytics/output:/usr/local/output -v C:\Repos\MECSim_Analytics/python:/usr/local/python -v C:\Repos\MECSim_Analytics/script:/usr/local/script --rm --name mecsim_container -p 8888:8888 -it mecsim --jupyter

docker: Error response from daemon: driver failed programming external connectivity on endpoint mecsim_container (6bd515b1957924776f7bb96a77ae31ba4c1f61486ae8c7b1e404701dc2778e02): Error starting userland proxy: mkdir /port/tcp: input/output error.


At present the MECSim source code itself is not available. Included here is a pre-compiled version MECSim that will run on Git Bash and Ubuntu. A docker version of MECSim is under development.


Suite of python codes to preform analysis of MECSim results and automated scripting of MECSim runs



No releases published


No packages published