Goldman-Hodgkin-Katz Equation Simulator

Image of sample screenshot of the GHK simulator. Click on the image to take you to the simulator page.
You wish your recordings were this clean…

This website was developed in response to the loss of the old (and excellent) GHK Simulator website by Steven Wright and Cindy Frank at the University of Arizona. My understanding is that the original site was written in Flash, and after Flash was sunsetted by Adobe, they had no choice but to take their website down. Their simulator still lives on as an iOS app, however!

I was inspired to do this many years ago around the time shortly after the OG GHK Simulator website was taken down. I remember preparing to teach Neurobiology, finding the site was taken down, and thinking to myself, “Well, that sucks.” I was looking on the internet for computing resources for a small unrelated project, discovered matplotlib and Python, and found among the myriad code examples an oscilloscope! I remember thinking to myself, “I can re-write a GHK simulator. How hard can it be?” I learned that I am not a software engineer, and my initial attempts at trying to re-create the GHK Simulator failed spectacularly. Oh well.

Several years passed. Then ChatGPT came along.

Many people have many different opinions on ChatGPT, but one thing I have found that it is very good at is coaching complete n00bs at coding (me) to produce functional code. I have no doubt that ChatGPT will have difficulty coding more complex things, but a GHK simulator doesn’t seem to be too complicated, especially with sample code to serve as a starting point. After learning that ChatGPT “understands” Python, it took me just a few evenings to come up with working Python code. Seriously.

I also learned that I am not a web developer. Something that I assumed ought to be pretty simple (running matplotlib animations embedded into a webpage) winds up being a non-trivial endeavor. Thankfully we have a great IT support staff at my institution. Joel Fite helped me get set up with webhosting, and James Macdonnell and Yongsu Kim helped convert and tweak my Python code into JavaScript. A few more days struggling with debugging some minor things with a good deal of help from ChatGPT, and this is the result – not bad for a n00b.

Note to self #1: JavaScript sliders send output as text strings by default. Use parseFloat()!

Note to self #2: JavaScript is a lot harder than Python 🙁

Our GHK Simulator is not as pretty as the now-defunct one from U. of AZ, but it works. I hope it is a useful resource for those learning and teaching the electrophysiology of membranes.

Note to readers that are experienced coders: I have a wishlist of features that I don’t know how to implement. If you are interested and actually do something about it, I would appreciate you letting me know what you did so I can add it to this website.



Mike Chao (mchao@csusb.edu)
Professor of Biology, California State University San Bernardino
Last modified July 2, 2024

Credits and licensing

The GHK Simulator is derived from sample oscilloscope code from the matplotlib website. The original code was written in Python (with help from ChatGPT 3.5) and converted to Javascript using Plotly for Python with a great deal of help from James Macdonnell (Information Technology Services) and Yongsu Kim (Dept. of Mathematics) at California State University San Bernardino. temml.org was used to convert LaTeX to MathML. Joel Fite (also from ITS) helped with setting up website hosting.

The GHK Simulator is copyright (c) 2024- by Mike Chao under the GNU General Public License v3.0 with additional terms as specified by the matplotlib licensing agreement; see the software license for details. The contents of this website are copyright (c) 2024- by Mike Chao under the Creative Commons CC BY-NC-SA 4.0 license.