Strange visualization results from Mesa example

Skip to first unread message

Nick Gotts

Jan 25, 2021, 7:27:04 AMJan 25



I intend to use Mesa to model Covid-19 transmission in hospitals. I have some limited previous experience with Python, but no previous experience with JavaScript. I have therefore been playing with the examples in order to improve my understanding, and particularly with boid_flockers, as I intend to use a continuous-space approach. I have installed Mesa within an anaconda virtual environment running Python 3.8, on a laptop running under Windows 10. I did also have a Python 3.7 virtual environment, but have now deleted that.


In order to understand the relationship between Python and JavaScript, I have tried making various changes to the files,, and simple_continuous_canvas.js, but this has produced results I find extremely puzzling. I hypothesize that information is being stored in places I have not found, but I have no idea where. (I am aware of two copies of these files now on my system, one at \path\to\anaconda3\envs\mesaenv38\mesa-master\examples\boid_flockers\boid_flockers, the other at \path\to\anaconda3\envs\mesaenv38\mesa-master\mesa\src\mesa\examples\boid_flockers\boid_flockers, although this was simply an outcome of the process of downloading and installing Mesa, not a deliberate choice on my part.)


The first puzzling result occurred when I attempted to copied the contents of \path\to\anaconda3\envs\mesaenv38\mesa-master\mesa\src\mesa\examples\boid_flockers to a directory path\to\anaconda3\envs\mesaenv38\mesa-master\mesa\src\mesa\examples\distancing, and made changes intended to add a polygon to the visualization. I found that nothing I did to the files made any difference to the visualization. Eventually, I tried deleting simple_continuous_canvas.js altogether – still no difference to the visualization. I deleted or renamed every copy of simple_continuous_canvas.js I could find on the system – still no change. Finally, I tried renaming the file, and changing the JavaScript filename in correspondingly. This, at last, produced a changed visualization, with the polygon showing. Presumably the instructions contained in the original simple_continuous_canvas.js file were stored somewhere, and “over-ruled” the changed versions I produced – but where? Having removed the Python 3.7 virtual environment, changing the name of simple_continuous_canvas.js in \path\to\anaconda3\envs\mesaenv38\mesa-master\mesa\src\mesa\examples\boid_flockers does abolish the visualization, but as I say, I had previously deleted or renamed every copy of that file I could find without effect.


The second puzzling result, which is still in evidence, resulted from editing simple_continuous_canvas.js so that an agent is shown as an unfilled circle of radius 10 rather than a filled circle of radius 2. Despite reverting to the original file, the visualization still shows the unfilled circles of radius 10. Again, I am led to conclude that the changes have been stored somewhere I can’t find them.


Can anyone suggest what is going on? Further details on request.



Nick Gotts

Reply all
Reply to author
0 new messages