diff --git a/fire-101/fire-for-lai.ipynb b/fire-101/fire-for-lai.ipynb index 9785d6b..7e24893 100644 --- a/fire-101/fire-for-lai.ipynb +++ b/fire-101/fire-for-lai.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": { "editable": true, "scrolled": true, @@ -34,7 +34,39 @@ "import pandas as pd\n", "import ipywidgets as widgets\n", "import matplotlib.ticker as mtick\n", - "from IPython.display import YouTubeVideo, display" + "from IPython.display import YouTubeVideo, display\n", + "from helper_functions.mentimeter import Mentimeter" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Mentimeter(vote = 'https://www.menti.com/alohp2v13yqh',\n", + " result ='https://www.mentimeter.com/app/presentation/al3bon1eofr38siunek3o1ykwqqkf18w'\n", + " ).show()" ] }, { @@ -491,7 +523,11 @@ " ### How & where to invest (keep it simple)\n", " * Company investments\n", " * **401K**\n", - " * **Employee Stock Purchase Plans**\n", + " * Employee Stock Purchase Plans\n", + " * GWU investment options\n", + " * **GW 403(b) Supplemental Retirement Plan**\n", + " * **GW 401(a) Retirement Plan for Faculty and Staff**\n", + " * GW 457(b) Deferred Compensation Plan & GW 457(f) Restoration Plan\n", " * Online broker (Vanguard, Schwab, Robinhood, etc.)\n", " * **target age retirement fund**\n", " * **index funds**\n", @@ -504,6 +540,7 @@ "### Free money (Yes you heard that right)\n", " * Company benefits\n", " * 401k matching\n", + " * **403(b) with 401(a) funding plus matching**\n", " * Employee Stock Purchase Plan discounts\n", " * HSA and other tax free options\n", "* For advanced users only\n", @@ -619,17 +656,19 @@ "- FIRE Intro on Youtube - https://www.youtube.com/watch?v=8si7cqw9wm0\n", "- FIRE retirement calculator - https://playingwithfire.co/retirementcalculator/\n", "- Mr. Money Mustache & the 4% Rule - https://www.mrmoneymustache.com/2012/05/29/how-much-do-i-need-for-retirement/\n", - "- compound interest - https://www.fool.com/how-to-invest/thirteen-steps/step-1-change-your-life-with-one-calculation.aspx" + "- compound interest - https://www.fool.com/how-to-invest/thirteen-steps/step-1-change-your-life-with-one-calculation.aspx\n", + "- Was the 401(k) a mistake? - https://www.nytimes.com/2024/05/20/podcasts/the-daily/401k-retirement.html" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": { "scrolled": true }, - "outputs": [], - "source": [] + "source": [ + "## Citations\n", + "Cumby, James & Degiacomi, Matteo & Erastova, Valentina & Guven, Jonna & Hobday, Claire & Mey, Antonia & Pollak, Hannah & Szabla, RafaƂ. (2023). Course Materials for an Introduction to Data-Driven Chemistry. Journal of Open Source Education. 6. 192. 10.21105/jose.00192. " + ] }, { "cell_type": "code", diff --git a/fire-101/helper_functions/formatting.py b/fire-101/helper_functions/formatting.py new file mode 100644 index 0000000..f551c8e --- /dev/null +++ b/fire-101/helper_functions/formatting.py @@ -0,0 +1,63 @@ +""" +Functions to produce formatted string output in Jupyter notebooks +""" + +__all__ = ['format_pseudocode', + ] + +__author__ = "James Cumby" +__email__ = "james.cumby@ed.ac.uk" + + + +def format_pseudocode(steps, order): + """ Return pseudocode steps with correct indentation. + + Parameters + ---------- + + steps : dict + Dictionary of pseudocode steps with integer keys + order : list + List of integers defining order of steps + """ + + indent = 0 + shift = -1 + output = '' + + # for step in order: + # indent += shift + # if (('IF' in steps[step]) or ('FOR' in steps[step])) and shift == 0: + # indent -= 4 + # if steps[step][-1] == '.': + # count = 0 + # for character in steps[step][::-1]: + # if character != '.': + # break + # else: + # count += 1 + # indent -= 4*count + # output += " "*indent + steps[step]+'\n' + # shift = 0 + # if ('IF' in steps[step]) or ('FOR' in steps[step]): + # shift = 4 + # if ('CONTINUE' in steps[step]): + # shift = -8 + + for step in order: + output += " "*indent + steps[step]+'\n' + if steps[step][-1] == ':': + indent += 4 + elif steps[step][-1] == '.': + count = 0 + for character in steps[step][::-1]: + if character != '.': + break + else: + count += 1 + indent -= 4*count + if 'CONTINUE' in steps[step]: + indent -= 8 + + return output \ No newline at end of file diff --git a/fire-101/helper_functions/mentimeter.py b/fire-101/helper_functions/mentimeter.py new file mode 100644 index 0000000..b836a79 --- /dev/null +++ b/fire-101/helper_functions/mentimeter.py @@ -0,0 +1,49 @@ +""" +Class to help display mentimeter votes and results within a Jupyter Notebook +""" + +__author__ = 'James Cumby' +__email__ = 'james.cumby@ed.ac.uk' + +__all__ = ['Mentimeter',] + +from IPython.display import IFrame, HTML + +class Mentimeter(): + """ Produce HTML code suitable from mentimeter links""" + + def __init__(self, vote=None, result=None): + """ Set up vote and result (display) links. """ + self.vote = vote + self.display = result + + def _vote_iframe(self): + """ Generate IFrame HTML for voting page. """ + if self.vote is not None: + if self.display is not None: + width='30%' + else: + width='70%' + return "".format(self.vote, width) + else: + return "" + + def _display_iframe(self): + """ Generate IFrame HTML for results page. """ + if self.display is not None: + if self.vote is not None: + width='69%' + else: + width='90%' + return "".format(self.display, width) + else: + return "" + + def _single_div(self): + """ Combine voting and results iframes (as required) into single div """ + return "
{}
".format(self._vote_iframe() + self._display_iframe()) + + def show(self): + """ Return the ipython HTML object containing the iframes """ + return HTML(self._single_div()) + \ No newline at end of file