Jekyll2020-01-29T10:07:16-06:00https://hojasonn.github.io/jasonho.caPhysics, wanderlust, and other stuff.Jason Hoj.ho@usask.caAdding Animations to LaTeX2020-01-29T00:00:00-06:002020-01-29T00:00:00-06:00https://hojasonn.github.io/articles/Animating-in-LaTeX<p>I recently gave a departmental seminar of some of my most recent doctoral research
here at the University of Saskatchewan. As a part of that presentation, to
emphasize how a particular variation of sum rule worked, I included this animation
in my presentation:</p>
<p><img src="/assets/images/gsr.gif" alt="Gaussian sum rule demonstration" /></p>
<p>My presentation was built using LaTeX (using the presentation package <code class="highlighter-rouge">beamer</code>),
and I created a lot of the figures and diagrams using either Inkscape (for diagrams)
or Mathematica (for the plots).</p>
<p>I played around for a while with different strategies to animate within LaTeX, and
this is a summary of what I finally came up with after some hours of searching and
experimenting. I generate the frames of my animation using Mathematica.
I then use the <code class="highlighter-rouge">\animategraphics</code> command coming from the <a href="http://ctan.unsw.edu.au/macros/latex/contrib/animate/animate.pdf">LaTeX package <code class="highlighter-rouge">animate</code></a> to
animate the frames when compiling my <code class="highlighter-rouge">beamer</code> presentation.</p>
<p>First, to produce the figure, I used a toy spectral function defined by a sum of
Gaussians in Mathematica</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>spectralfunction[x_] := Exp[-(x - 3)^2] + Exp[-((x - 7)^2/2)]/Sqrt[2] + Exp[-((x - 11)^2/3)]/Sqrt[3]
</code></pre></div></div>
<p>For my purposes, I was interested in plotting this toy spectral function alongside a Gaussian function, as well
as the product of the Gaussian function with the toy spectral function. The code for the animation within Mathematica
would look something like this (I’ve eliminated some normalization factors from my own plot displayed above that shouldn’t change how the code works):</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Animate[
Plot[{spectralfunction[x], Exp[-(s - x)^2/(4)], spectralfunction[x]Exp[-(s - x)^2/(4)]}, {x, 0, 15},
PlotRange -> Full,
Ticks -> None,
ImageSize -> Large,
PlotLegends -> Placed[{"\!\(\*SuperscriptBox[\(\[Rho]\), \(had\)]\)", "Gaussian kernel", "GSR"}, Below],
AxesLabel -> {"t", ""}
],
{s, 0, 14, 0.1}
]
</code></pre></div></div>
<p>To make this animation using the <code class="highlighter-rouge">\animategraphics</code> LaTeX environment, we need to export this animation to a series of still frames.
To do this, instead of plotting the above animation above, I instead created a <code class="highlighter-rouge">Table</code> holding each frame of the animation
(essentially switching out the <code class="highlighter-rouge">Animate</code> command for a <code class="highlighter-rouge">Table</code> command):</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>frameTable = Table[
Plot[{spectralfunction[x], Exp[-(s - x)^2/(4)], spectralfunction[x]Exp[-(s - x)^2/(4)]}, {x, 0, 15},
PlotRange -> Full,
Ticks -> None,
ImageSize -> Large,
PlotLegends -> Placed[{"\!\(\*SuperscriptBox[\(\[Rho]\), \(had\)]\)", "Gaussian kernel", "GSR"}, Below],
AxesLabel -> {"t", ""}
],
{s, 0, 14, 0.1}
];
</code></pre></div></div>
<p>Note that suppressing the output is useful here if you’re dealing with a large number of images.
To export these images, I iterate through each element of <code class="highlighter-rouge">frameTable</code>, exporting to the filename <code class="highlighter-rouge">animation-GSRfit_{FRAMENO}.png</code>, where <code class="highlighter-rouge">{FRAMENO}</code>
ranged from 001 to 141. This will be important in order to use the <code class="highlighter-rouge">animate</code> package.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Table[
Export[
FileNameJoin[{StringJoin["animation-GSRfit_", StringTake[ToString[NumberForm[i, 2, NumberPadding -> {"0", ""}]], -3], ".png"]}],
table[[i]],
"PNG"],
{i, Length[table]}
]
</code></pre></div></div>
<p>I’ve coded in number padding into the filenaming convention above such that all files will have the same number of digits in their naming convention.
In this case, my frame numbering runs from 001 to 141.</p>
<p>Finally, in LaTeX (using the <code class="highlighter-rouge">beamer</code> package), I used this block of code to render all the images into an animated figures</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>\begin{frame}{Gaussian Sum Rules}
\centering
\animategraphics[autoplay,loop,height=5cm]{30}{animation-GSRfit_}{001}{141}
\end{frame}
</code></pre></div></div>
<p>The <code class="highlighter-rouge">frame</code> environment is an element of beamer; the <code class="highlighter-rouge">\animategraphics</code> command takes
the following syntax:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>\animategraphics[options]{frames per second}{filename without frame number}{first frame number}{last frame number}
</code></pre></div></div>
<p>My figures were saved with the filename <code class="highlighter-rouge">animation-GSRfit_{FRAMENO}</code>, where <code class="highlighter-rouge">{FRAMENO}</code>
ranged from 001 to 141, indicating the beginning and end of our animation that we would indicate here.
Many more options can be explored in the <a href="http://ctan.unsw.edu.au/macros/latex/contrib/animate/animate.pdf">manual for the <code class="highlighter-rouge">animate</code> package</a>.</p>
<p>One note: I have noticed that not all PDF viewing programs have been able to handle these animations; the only reliable options I’ve found
has been Adobe Acrobat Reader, though I’m sure there’s others.</p>
<p>I have to note that there are tools within Mathematica to export GIFs and video files. <a href="https://mathematica.stackexchange.com/questions/85565/how-to-monitor-the-progress-of-exporting-of-animated-gif">There are discussions around whether this is worthwhile</a>; I personally like the control that exporting individual frames gives me.
For the 140 frames I generated for this simple plot, it took a few minutes on my Lenovo X220 laptop (Intel® Core™ i5-2540M CPU @ 2.60GHz × 4), and the total size of all the files produced was only 1.5 MB. I don’t often use animations in my presentations, so it is possible I’d rethink this strategy if I were generating these figures more often.</p>Jason Hoj.ho@usask.caI recently gave a departmental seminar of some of my most recent doctoral research here at the University of Saskatchewan. As a part of that presentation, to emphasize how a particular variation of sum rule worked, I included this animation in my presentation:Models and Effective Theories of the Strong Interaction2019-11-10T00:00:00-06:002019-11-10T00:00:00-06:00https://hojasonn.github.io/models-effective-theories-strong-interactions<p>It’s been about six months since I finished my comprehensive exam requirements
for my doctoral program at the University of Saskatchewan; it’s taken a little longer
than I expected, but I’m happy to say it’s complete. This report was one of the
products of that experience. If you want a more pedegogical overview, start with
the <a href="/the-scalar-meson-puzzle/">data visualization that I created out of this project</a>,
otherwise please take a look at the link below.</p>
<p><a href="/assets/files/ho-comprehensive-2019.pdf">Comprehensive Exam Report: Models and Effective Theories of the Strong Interaction</a></p>Jason Hoj.ho@usask.cacomprehensive exam reportintroduction to the standard model of physics2019-11-10T00:00:00-06:002019-11-10T00:00:00-06:00https://hojasonn.github.io/the-standard-model<p>To understand a little bit about particle physics and what is happening at the core of everything we see every day, perhaps it’s best to start at the end: the Standard Model of Particle Physics.</p>
<p>At its core, particle physics can be described as the study of matter (basically everything we observe and interact with everyday) and of the interactions and forces that manifest between and within matter. For centuries humanity has studied matter with great interest. Over time, our understanding has increased, and our physical models have grown better at predicting how our world works. Atomic theory, well-established for
almost a century, tells us that matter is made up of atoms, which are in turn made up of smaller constituents:
protons, neutrons, and electrons.</p>
<p>Our picture of matter has become more sophisticated since the advent of atomic theory. The most recent understanding of matter and its interactions is summarized in The Standard Model of Particle Physics. It’s here where our atomic theory becomes weirder and more wonderful. While the electron appears to this day to be a fundamental particle (that is, it has the properties of a point particle and doesn’t appear to have any deeper structure), close examination of the proton and neutron revealed they were constructed of even smaller particles. We know this because <a href="https://www.smbc-comics.com/comic/2014-11-25">as we smash particles with more and more speed, we find out more about what’s inside</a>. Here’s where the naming conventions get quirky (it was the 70’s after all), as these constituent particles in the proton and neutron come to be known as “up” quarks and “down” quarks (<strong>u</strong> and <strong>d</strong> in the above figure). But as you might notice in the diagram, these were not the only quarks found! Other particles were found to be made up of quarks, and soon the “strange” (<strong>s</strong>), “charm” (<strong>c</strong>), “bottom” (<strong>b</strong>), and “top” (<strong>t</strong>) quarks were also discovered. Soon, just like the atoms of atomic theory, scientists began to understand enough to start categorizing these fundamental particles in a sort of Periodic Table:</p>
<p><img src="https://hojasonn.github.io/media/StandardModel.png" alt="The Standard Model as depicted in the documentary "Particle Fever"" /></p>
<p>The rest of the particles along the outside of the circle (highlighted in green) are leptons, made up of the electron and its cousins the tau and the muon, and their corresponding generations of neutrinos. These are important aspects of the Standard Model, but not something I’ll go into detail to now.</p>
<p>These are the actors in our production; most everything we see, smell, taste, and touch is made up of these players.</p>
<p>What really segregates the Standard Model are interactions (forces). In some sense, these are the same forces you probably talked about in high-school physics, just at much, much smaller distances. Within the Standard Model, matter interacts through particles called gauge bosons (also known more casually as “force-carriers”). Electromagnetic interactions occur through the exchange of a photon (<strong>γ</strong>) between two particles. The other forces represented in the Standard Model are the weak nuclear force (governed by the exchange of <strong>W</strong> and <strong>Z</strong> bosons), and the strong nuclear force (governed by the exchange of a gluon, <strong>g</strong>).</p>
<p>But behind all of this hand-waving lie mathematical theories that have stood the test (and experiments) of time.
The theory of electromagnetism is more technically referred to as Quantum Electrodynamics (QED).
We can bring in the theory of the weak nuclear force and combine it with electromagnetism to get the Electroweak Theory.
Finally, we have the theory describing the strong nuclear force, which is called Quantum Chromodynamics.</p>
<p>This is where my work lives. I study the interactions of quarks and gluons within bound states of hadrons, which is a general term for matter that is made up of quarks. It’s here where protons, neutrons, and a zoo of other particles are created.</p>
<p>So what’s the big deal with Quantum Chromodynamics? And how did we get to our current understanding about particle physics? Stayed tuned to find out…</p>Jason Hoj.ho@usask.caperhaps it's best to start at the beginningthe sacred table2019-11-01T00:00:00-06:002019-11-01T00:00:00-06:00https://hojasonn.github.io/the-sacred-table<p>In the museum and memorial that now stands at Auschwitz, amongst the rows of reconstructed dormitories, there is an unassuming building, uniform and indistinguishable from its neighbour. In this building there is a room, and in this room there is a mountain of beautiful but eclectic pots. The vibrant colors remain even after eight decades, and since beauty is so rare at Auschwitz, it’s easy to lose sight of their significance. Each pot once belonged to a Jewish family brought to the camp, and the bright colors that once decorated a room now echo a warning of danger.</p>
<center>
<figure>
<img src="/assets/images/auschwitz-pots.jpg" />
<figcaption>photo taken by Paweł Sawicki, <a href="http://auschwitz.org/en/gallery/exhibits/evidence-of-crimes,1.html" title="Pans and pots that belonged to people brought to Auschwitz for extermination">auschwitz.org</a>.</figcaption>
</figure>
</center>
<p>The first time I stood in that room, I pictured a husband and a wife, clutching their children in a ghetto, being rounded up and forced to pack one suitcase of their belongings. Only the most precious things were packed, each item a symbol of their battered hope in the future.
Why, amongst everything, did a bulky, awkward pot make the cut? Because that pot was a centerpiece to the family table, a witness to regular meals and shabbat dinners. Bringing that pot was a symbol of hope that no matter where they were being taken or what suffering ensued, there would still be meals to be shared. Each pot was brought with the intention of uniting family, community, and friends together around a table, and to share love, laughter, and sorrow.</p>
<p>Of all the collective horrors, and legacies of pain and terror, I was surprised at how deeply that mountain of pots spoke to me.</p>
<p>I’ve loved to cook for much of my life. My father, a Vietnamese refugee who settled in Canada, did most of the cooking in the household when I was growing up, and I spent a lot of time together with him preparing meals or watching him while I did homework at the kitchen table. Most weekends my family would gather around the table for a huge bowl of Vietnamese beef soup that my father prepared for each of us. He would stay up all night tending to huge pot on our stove, just to make sure the delicate broth was pristine in color, clarity, and flavor. I suspect one of the ways he coped away from the world which was most familiar to him was to draw upon the flavours and aromas of his childhood. It was his way of mourning a world that he lost, and a way of honoring his cultural history and traditions through the sacrament of the family dinner table. At its core, cooking was the language in which he loved us. And as I learned to cook the same dishes my father prepared for me growing up, it became a way of connecting to a culture I shared from a country I never knew.</p>
<p>When I began to travel, food and cooking developed a different dimension in my life. The experiences I had in new cities and countries were ingrained in the flavours imprinted upon me. Cooking was a way I could reach back into my past to those memories and relive them, and every time I found myself in a new culture, I searched for a flavour I could anchor my memories to. In India, I remember drinking hot glasses of Masala chai, while finding shade under the burning New Dehli sun. In Hong Kong, the savory-sweetness of <em>cha siu</em> while watching the world bustle by. Food and memory are intricately linked in my mind. And now, as I’ve moved away from the home I grew up in, I find I deal with homesickness in the same way I like to think my father did: by pulling out old family recipes.</p>
<p>But, I admit, food is a strange thing to connect to Auschwitz. When I first saw the concentration camp, it was with a Holocaust educational experience called the <a href="http://www.marchofremembranceandhope.org/">March of Remembrance and Hope</a> (MRH), alongside thirty other university students from across Canada. We travelled through Germany and Poland for ten days, led by a Holocaust survivor named <a href="https://memoirs.azrielifoundation.org/survivor/pinchas-gutter">Pinchas Gutter</a>, who told his story on the very ground it took place on all those years ago. There were many powerful memories and emotions associated with that time together with my MRH family, but there were two themes in particular that stood out to me: the power in the act of remembrance, and the importance of lifting one another up in community. Over the years since, there are two memories in particular that I keep coming back to. One is the feeling I had when I first encountered the pots. Second is the memory of the first shabbat dinner we had as a group in Poland. In a little Jewish restaurant in Krakow, we broke bread and had a meal as a group, observing an ancient ritual of intentional rest and remembrance. As we lit the candles and poured the wine, Pinchas closed his eyes and sang the prayers and shabbat blessings that he had done so many times before. We gathered, we ate, we laughed, and we told stories. Only hours beforehand I had been standing before those colorful pots of hope; right then at that table, I was experiencing the moment of hope that all those families held. It struck me later that it was not the food that made that moment memorable, but the new friends I shared that table with, and being bonded together as community through ritual.</p>
<p>Food and cooking has become part of my own identity and language of love, but I’ve come to recognize the emptiness of food without this community. It’s not the food that blesses the tables we gather around; it’s the people who surround it. For the most humble meal can be elevated as long as it’s shared, and the most extravagant banquet is wasted without guests. It wasn’t the pots that stopped me in my steps at Auschwitz; it was the empty tables I pictured them centered on. It’s not the food or the flavors that create the community; it’s the food that amplifies the community. Food binds us to one another, and is meant to be enjoyed in community.</p>
<p>And so, every shabbat evening that I have the chance, I take the time to prepare two loaves of challah, the same bread we shared that shabbat evening in Krakow. As I knead and braid the loaves, my mind returns to my experience with MRH, the friendships that sparked, the timbre of Pinchas’ song, the images burned into my memory, and that regardless of race, creed, or identity we are all children made in the image of God, having inherent value beyond the work we do or the things we create. It’s these two loaves of bread that I anchor those memories to. One loaf I keep, to enjoy and remember. The second I share– because nothing reminds us of our shared humanity or creates community quite like breaking bread.</p>
<p><em><a href="http://www.marchofremembranceandhope.org/registration-form">Applications for the 2020 March of Remembrance and Hope cohort are now open until January 14, 2020.</a> It’s a program that I deeply believe in, and continue to volunteer my time to; apply today.</em></p>Jason Hoj.ho@usask.cathe scalar meson puzzle2019-08-29T00:00:00-06:002019-08-29T00:00:00-06:00https://hojasonn.github.io/the-scalar-meson-puzzle<p>I’ve been dabbling in data visualization using Tableau over the past year, and trying to find a way to incorporate the software into my research. Tableau is well-crafted for making polished and accessible graphs and visualizations, but often if I’m working on a academic paper or presentation it doesn’t integrate naturally into the traditional publication format (i.e. LaTeX or slideshow). One of the big literature reviews that I did this year was focused on the scalar meson states below 2 GeV, and how the identification of these states as quark-antiquark meson states is difficult to reconcile with the patterns we see in the data. I thought this might be an interesting subject to craft a <a href="https://public.tableau.com/profile/jason.ho8271#!/vizhome/TheScalarMesonPuzzle/TheScalarMesonPuzzle">short dataviz presentation</a> about because I find the nonet diagrams to be beautiful representations of the mathematical group structure underlying QCD (regardless of your familiarity with group theory).</p>
<p>In the Data Story, the first few slides are primarily background information and a (brief!) introduction to quarks as well as the internal structure of protons, neutrons, and other hadrons. The nonet diagrams are a modification of <a href="https://www.thedataschool.co.uk/ellen-blackburn/a-simple-way-to-make-a-radar-chart/">spider-plots</a> in Tableau, which are not a native feature and require calculating a coordinate transformation to feed into Tableau, in which I used a radial dimension to indicate the relative mass differences between the states. I’m not completely convinced this is the <em>best</em> way to display this information, but I love how it plays off of the traditional <a href="http://hep.uchicago.edu/~rosner/eight.pdf">Eightfold Way</a> representation of the hadronic states rooted in group theory. I also augmented these plots with some basic line plots in order to better show the differences in mass hierarchy between the pseudoscalar/vector systems and the scalar system.</p>
<iframe src="https://public.tableau.com/views/TheScalarMesonPuzzle/TheScalarMesonPuzzle?:showVizHome=no&:embed=true" width="1050" height="700"></iframe>Jason Hoj.ho@usask.cadabbling in data visualizationstranger in a strange land2018-04-12T00:00:00-06:002018-04-12T00:00:00-06:00https://hojasonn.github.io/stranger-in-a-strange-land<p><em>You shall treat the stranger who sojourns with you as the native among you, and you shall love him as yourself, for you were strangers in the land of Egypt: I am the LORD your God.</em> -Leviticus 19:34</p>
<p>Frequently, out of nowhere, the sky will open up unleashing torrential rainstorms of biblical proportions upon the populace of Guangzhou (whose response is inversely proportional to the magnitude of the storm). This is the rainy season. It’s business as usual.
A women sits at my table looking to escape the Noahic drama outside the glass doors; I’m in the middle of scribbling down common Chinese characters and phrases into a notebook. It’s good practice, and less reliance on my ageing cell phone is a comfort. She strikes up a conversation, and we spend the next two hours trading English for Chinese, moving from the coffee shop to a local dumpling restaurant. It’s the first meaningful human interaction I’ve had in a while in the busyness of research at the University, and I find myself deeply grateful for the chance encounter.</p>
<p>My research group has a close relationship with a number of Chinese researchers, and we’ve hosted a number of foreign students and postdocs during my time at the university. There have been some that I’ve developed a strong relationship with, and there are others that have been more difficult to connect with, but it’s no doubt more difficult to develop a relationship with someone when there’s a language and culture barrier to traverse. Sometimes that relationship-building is fun and engaging, such as introducing them to local food, coffee, or craft beer culture. Other times it’s more tedious, and means helping out with the more mundane aspects of life (setting up a bank account, dealing with customer service phone calls, helping them navigate the transit system, etc.)</p>
<p>At times, I haven’t been as patient as I should have been. At times, I find myself reluctant to reach out, to practice hospitality, and to make them feel welcome. And while recognizing the importance of boundaries and of self-care, my time in China has shown me a different side of that experience.</p>
<p>I’m struck with the relative privilege I’ve had as an English-speaking traveler; though I think we all can relate to times when we’ve felt like strangers or outsiders, for me it’s taken traveling to a different country and removing the comforts that a shared language affords to really grasp this. Two months has been enough time to shed the excitement that comes from experiencing a new country, to cultivate a feeling of familiarity and routine, yet not a feeling of comfort. It’s long enough to invoke that feeling of uprootedness that comes from moving to a different city. Yet add to equation the problems that come with not being able to speak read the local language, and the relative rarity of understanding of English; in China, I’m functionally deaf and mute. In all of my travels, in all of my life, I think this is the closest I’ve come to understanding what it means to be a stranger in a strange land. Here, I’m creating a community from scratch, while trying to navigate a totally different culture and way of living.</p>
<p>Hospitality takes on a different meaning when you are the stranger. The small acts of patience and kindness I’ve received have been all the more memorable to me; the first week I was here, I felt like a child, being led around and shown the layout of the campus, where to get food and how to get to my office. People have spoken for me, fought for me, and given of their time and money for me to be here. Locals off the street have taken time to show me how to get around, and even invited me to eat with them.</p>
<p>I’m grateful for this experience to be a stranger in a strange land. I write this with myself in mind, so that I may preserve and remember: This is how it feels to be a stranger; remember this, and welcome the strangers in your life as a native amoung you. Don’t be busy, don’t be timid. Love the lonely, the removed, the foreign, and the isolated.</p>Jason Hoj.ho@usask.ca