°Master of Science

Evolving Galactic Dynamos and Fits to the Reversing Rotation Measures in Edge-On

by

Alex Woodfinden

A thesis submitted to the Department of Physics, Engineering Physics & Astronomy in conformity with the requirements for the degree of Master of Science

Queen’s University Kingston, Ontario, Canada April 2019

Copyright © Alex Woodfinden, 2019 Abstract

Rotation measure (RM) synthesis maps of NGC 4631 by Mora-Partiarroyo et al. (2018) show remarkable sign reversals on kpc scales as the distance from the minor axis increases in the northern halo of the . RM maps for edge-on galaxies observed in the CHANG-ES sample were searched through and show that regular reversals in the sign of the RM seen in galaxies appears to be a common phenomenon. These sign reversals can be naturally explained by a regular halo magnetic field that is alternating its azimuthal direction on kpc scales in the galaxy. This is a brand new phenomenon that has never before been observed in a galactic halo. Evidence of magnetic fields showing both axisymmetric and bisymmetric symmetry is found in the data. To explain this new phenomenon the dynamo equations are solved under the as- sumption of scale invariance and rotating logarithmic spiral solutions are searched for. The model solutions are then compared to the observational RM map of NGC 4631 in order to draw conclusions on the type of field geometry likely found in the galactic halo. Solutions for velocity fields that represent accretion onto the disk, outflow from the disk, and rotation-only in the disk are found that produce RM maps with reversing signs viewed edge-on. Model RM maps are created for a variety of input parameters using a Faraday screen technique and are then scaled to match the amplitude of the

i observational maps. Residual images are then made and compared with one another in order to determine the models that provide the best fit to the data. Solutions for rotation-only, i.e. relative to a pattern uniform rotation, did in general, not fit the observational map of NGC 4631 well. Outflow models provided a reasonable fit to the magnetic field. However, the best results for the region modelled in the northern halo are found using accretion models. As there is abundant evidence for both winds and accretion in NGC 4631, this modelling technique has the potential to be able to distinguish between the dominant flows in galaxies.

ii Statement of Co-Authorship

The research presented in this thesis was done under the supervision of Judith Irwin (Queen’s University) and Richard Henriksen (Queen’s University). All the work pre- sented here was done by the author (Alex Woodfinden) except where explicitly stated otherwise. Chapter 3 contains a version of a manuscript submitted to the Monthly Notices of the Royal Astronomical Society as: ”Evolving Galactic Dynamos and Fits to the Reversing Rotation Measures in the Halo of NGC 4631”. A. Woodfinden, R.N. Hen- riksen, J. Irwin, and S.C. Mora-Partiarroyo. I am the lead author of this work. The theoretical basis of this manuscript presented in Sect. 3.3 & 3.4 was developed by Richard Henriksen who wrote these sections of the submitted manuscript. Fig- ures included in these sections (Figs. 3.3, 3.4, 3.5, 3.6, 3.7 & 3.8) were produced by Richard Henriksen with the exception of the rotation measure images in Figures 3.3, 3.5, 3.6 & 3.8 which were produced by myself. Judith Irwin and Richard Henriksen edited the submitted manuscript. Observational data for this manuscript, as seen in Figure 3.1, was provided by coauthor S.C. Mora-Partiattoyo. All other sections of this manuscript are my own work. Chapter 3 discusses fitting solutions to the dynamo equations with real observa- tional images. The actual fitting for this analysis was performed by myself while the

iii solutions to the dynamo equations were provided by Richard Henriksen in the form of MAPLE1 worksheets that were subsequently modified by myself. See Sect. 2.3 for more details on this. Code used to convert image formats as well as perform the data analysis (see App. D & E) was written by the author. Chapter 4 discusses the rotation measure images of other galaxies in the CHANG- ES sample. The rotation measure data was provided by Phillip Schmidt, a member of the CHANG-ES collaboration. All images made and subsequent analysis of this data was performed by the author.

1www.maplesoft.com iv Acknowledgments

First of all, I would like to thank my supervisors Judith Irwin and Richard Henriksen for providing me the opportunity to complete this project. I am thankful for all that I have learned from you both as well as the opportunity to travel and collaborate with others around the world. It has truly been a pleasure working with both of you and I greatly appreciate all the advice, support, and guidance given over the past two years. I would also like to thank my family for their constant support as well as always being there for me. Thank you for always taking the time to listen and your support has always been appreciated. Thank you to all my friends, in particular Alex for always being there as a source of support and encouragement. I would also like to thank my new friends I have met at Queens and all their advice, it has truly been helpful in completing this project. I am thankful for the support from the Queen Elizabeth II Scholarship and would like to thank the Queen’s Physics Department faculty for all that I have learned over the last two years as well as the staff whose hard work is always appreciated.

v Contents

Abstract i

Statement of Co-Authorship iii

Acknowledgments v

Contents vi

List of Tables viii

List of Figures ix

Chapter 1: Introduction 1 1.1 CHANG-ES Project ...... 3 1.1.1 CHANG-ES Data Products ...... 7 1.2 FaradayRotation...... 9 1.2.1 Derivation ...... 11 1.3 Rotation Measure Synthesis ...... 16 1.4 Organization of Thesis ...... 21

Chapter 2: Preparation For Fitting Dynamo Models 23 2.1 Dynamos...... 23 2.2 DynamoSolutions...... 26 2.3 Implementation ...... 29

Chapter 3: Evolving Galactic Dynamos and Fits to the Reversing Rotation Measures in the Halo of NGC 4631 34 3.1 Abstract...... 34 3.2 Introduction...... 35 3.3 Scale Invariant, Evolving, Magnetic Dynamo Spiral fields ...... 41 3.3.1 Boundary conditions ...... 52 3.4 Generic Scale Invariant Dynamo Magnetic Field Modes ...... 53

vi 3.4.1 Outflow or Accretion in the Pattern Reference Frame . . . . . 54 3.4.2 RM Screen for Face-on Galaxies ...... 63 3.5 FittoNGC4631 ...... 65 3.6 Comparison with Previous Models ...... 75 3.7 Conclusions ...... 77

Chapter 4: Other Galaxies in the CHANG-ES Sample 78 4.0.1 General Trends ...... 80 4.0.2 Axisymmetric and Bisymmetric Signatures in the Data . . . . 81 4.0.3 Serendipitous Results ...... 82

Chapter 5: Conclusions 84

Appendix A: General Results and Observational Expectations 100 A.1 Outflow or Accretion in the Pattern Reference Frame ...... 105 A.2 Rotation-Only in the Pattern Reference Frame ...... 109

Appendix B: Conversion From Maple Table to FITS Format 110

Appendix C: Rotation Measure Synthesis Images 112

Appendix D: Code: Maple Output to Fits File Conversion 133

Appendix E: Code: Automation of Analysis to Search a Large Pa- rameter Space 144

vii List of Tables

1.1 Summary of the technical specification of measurements from the EVLA 9 1.2 Limits of CHANG-ES measurements in Faraday space ...... 21

2.1 Physical interpretation of parameters used in dynamo equation solutions. 26 2.2 Self-similarity Class Identification ...... 27

3.1 Best fit dynamo solutions to NGC 4631 without combining spiral modes 70 3.2 Best fit dynamo solutions to NGC 4631 with combining spiral modes 71

C.1 RMS values for selected CHANG-ES galaxies in L-Band ...... 132

viii List of Figures

1.1 Gaseous Halo of a Galaxy ...... 4 1.2 Face-on galaxy NGC 5457 ...... 5 1.3 Edge-on galaxy NGC 4631 ...... 6 1.4 VLA...... 7 1.5 Visualization of a Data Cube ...... 10 1.6 Electric Field Vector of a Polarized Electromagnetic Wave ...... 11 1.7 Faraday Rotation along an axis...... 15

2.1 Toroidal Vs Poloidal Schematic ...... 25 2.2 Effect of Varying the Spiral Mode Number ...... 28 2.3 Effect of varying the Spiral Pitch Angle ...... 30 2.4 Effect of Varying the Rotation Rate ...... 31

3.1 Rotation measure map for NGC 4631 ...... 38 3.2 Examples of axisymmetric and bisymmetric field geometry...... 39 3.3 Field geometries and rotation measure map for an example dynamo solutionwithoutflow...... 56 3.4 Magnetic field line loop for an example dynamo solution...... 58 3.5 Field geometries and rotation measure map for an example dynamo solution with accretion...... 59

ix 3.6 Rotation measure map and field geometry for an example dynamo so- lution with accretion and a higher order spiral mode number . . . . . 60 3.7 Magnetic field geometry of an example dynamo solution undergoing rotation with respect to the line of sight ...... 62 3.8 Rotation measure map for an example face-on dynamo solution . . . 66 3.9 Best fit outflow solution matched to NGC 4631 ...... 73 3.10 Best fit inflow solution matched to NGC 4631 ...... 74

A.1 Example rotation measure maps when varying the spiral mode number 102 A.2 Example rotation measure maps when varying the spiral pitch angle . 103 A.3 Example rotation measure maps when varying the rate of rotation of themagneticfield...... 104 A.4 Example rotation measure maps of an accretion solution when varying the wind speed ...... 106 A.5 Comparison of rotation measure maps for an inflow versus outflow so- lution ...... 107 A.6 Example rotation measure maps when varying the rate of the similarity class of the dynamo solution ...... 108

C.1 NGC 660 RM Synthesis Image + Error ...... 113 C.2 NGC 2613 RM Synthesis Image + Error ...... 114 C.3 NGC 2992 RM Synthesis Image + Error ...... 115 C.4 NGC 3044 RM Synthesis Image + Error ...... 116 C.5 NGC 3079 RM Synthesis Image + Error ...... 117 C.6 NGC 3448 RM Synthesis Image + Error ...... 118 C.7 NGC 4013 RM Synthesis Image + Error ...... 119 x C.8 NGC 4192 RM Synthesis Image + Error ...... 120 C.9 NGC 4217 RM Synthesis Image + Error ...... 121 C.10 NGC 4302 RM Synthesis Image + Error ...... 122 C.11 NGC 4388 RM Synthesis Image + Error ...... 123 C.12 NGC 4438 RM Synthesis Image + Error ...... 124 C.13 NGC 4594 RM Synthesis Image + Error ...... 125 C.14 NGC 4631 RM Synthesis Image + Error ...... 126 C.15 NGC 4666 RM Synthesis Image + Error ...... 127 C.16 NGC 4845 RM Synthesis Image + Error ...... 128 C.17 NGC 5084 RM Synthesis Image + Error ...... 129 C.18 NGC 5775 RM Synthesis Image + Error ...... 130 C.19 UGC 10288 RM Synthesis Image + Error ...... 131

xi 1

Chapter 1

Introduction

Recent advances in observational techniques, particularly in radio astronomy, have been able to show the existence and strength of magnetic fields in the Universe. Magnetic fields are a major component of the interstellar and the intracluster medium of galaxies affecting the physical processes in a variety of ways. They contribute to the total pressure in the galactic disk, influence intracluster and gas flow dynamics, and stabilize gas clouds to modify the -formation efficiency (Beck, 2016). Cosmic rays (highly energetic atomic nuclei travelling at speeds near the speed of light) accelerated by shocks containing magnetic fields can provide the pressure to drive gas away from a galaxy in a galactic outflow. The relationship between magnetic field and gas dynamics is crucial in the understanding of the physics of galactic disks and halos as well as their evolution. In galaxies large-scale, ordered magnetic fields appear to be common in galactic disks and halos as well as in the medium between galaxies. The strengths and geome- tries of these observed galactic magnetic fields can be used to test theories as to how these fields are generated. Such knowledge is needed in order to properly understand these fields and their interactions with matter (Beck, 2016). 2

Spiral galaxies contain several different components (see Fig. 1.1). They contain a central disk composed mainly of and some gas, as well a central bulge region and a supermassive black hole at the galactic center. Around this surrounds a gaseous halo as well as older star and globular clusters. A galaxy will also be surrounded by a dark matter halo (not shown) however for the purpose of this thesis a galaxy’s halo will refer to the gaseous halo. The halo of a galaxy connects the baryon-rich intergalactic medium (IGM) to the star forming disk in spiral galaxies. The halo contains future star formation fuel and will be composed of a mixture of gas resulting from both accretion from the IGM as well as outflow from the galactic disk. The halo contains multiphase gas whose origin comes from a variety of processes. Constituents of this multiphase halo include: neutral hydrogen at temperatures < 104K detectable through 21-cm line emission, warm gas that is largely ionized with temperatures between 104K and 106K detectable primarily through optical line emission, hot gas with a temperature > 106K detectable through x-ray observations, as well as dust, magnetic fields, and cosmic rays (Putman et al., 2012) (Dettmar, 2012). Radio continuum and polarization observations in galactic halos have started to reveal the magnetic field structure and strength in nearby spiral galaxies. Well ordered magnetic fields are known to be common to galactic halos and observations show a spiral shape along the disk plane as well as a X-shaped magnetic field perpendicular to the line of sight in the halo (Tullmann¨ and Dettmar, 2000; Krause, M. et al., 2006; Heesen, V. et al., 2009; Braun et al., 2010; Soida, M. et al., 2011; Haverkorn and Heesen, 2012; Dettmar and Soida, 2006) (also see the polarization vectors in Fig. 1.3). The strength of the halo field is comparable to that of the disk, typically of 1.1. CHANG-ES PROJECT 3

the order of a few µG. A relation between the galactic wind, the total magnetic field strength, and the star formation in the galaxy has also been found (Krause, 2015). The inclination of a galaxy is the angle at which a galaxy is viewed. A perfectly face-on galaxy (see Fig. 1.2) will have an inclination of 0°, while a perfectly edge-on galaxy (See Fig. 1.3) will have an inclination of 90°. Galaxies are studied at different inclinations to help reveal different properties. Studies of the magnetic field of face-on galaxies are best at revealing the field in the galactic disk. Studies of the magnetic field of edge-on galaxies can reveal the magnetic field of the galactic halo.

1.1 CHANG-ES Project

Data used in this thesis were observed as part of the Continuum Halos in Nearby Galaxies - an EVLA Survey (CHANG-ES) project as described by Irwin et al. (2012). Details about the first data release are provided by Wiegert et al. (2015) and the observational methods are described by Irwin et al. (2013). The main objectives of this survey are to investigate the physical properties and origins of the gaseous halos of galaxies. More specifically the project aims to characterize cosmic ray transport and wind speed, measure Faraday rotation (see Sect. 1.2), and map the magnetic field of galaxy halos. Observations in the CHANG-ES project were conducted using the Karl G. Jansky Very Large Array (JVLA, formally the Extended Very Large Array or EVLA) in C- band (C & D Arrays) and L-Band (B, C, & D Arrays) as seen in Fig. 1.4. Table 1.1 provides the frequency ranges for these bands. Thirty-five nearby edge-on galaxies were observed in the radio continuum for a total of 405 hours. Galaxies were selected from the Tully and Fisher Nearby Galaxies Catalogue (Tully and Fisher, 1988) based 1.1. CHANG-ES PROJECT 4

Figure 1.1: The median edge-on from 30 galaxies in the CHANG-ES survery (see Sect. 1.1) shown in blue-grey from L-band data (see Table 1.2). This image was made by stacking 30 of the CHANG-ES galaxies that were all scaled to be the same angular size. Superimposed on this image is an optical image of NGC 5775. A spiral galaxy will contain a central disk composed mainly of stars and some gas as well a a central bulge region. Around this surrounds a gaseous halo. The dark matter halo is not shown in this figure. Image Credit: Irwin et al. (2019)

0 0 on their inclination (> 75°), optical diameter (4 < d25 < 15 ), and flux density

(S1.4GHz ≥ 23 mJy).

An inclination greater than 75° was chosen so that edge-on galaxies are selected.

0 0 A optical diameter of 4 < d25 < 15 was chosen to be able to get sufficient images from the EVLA. The lower limit of 40 was chosen in order to obtain sufficient spatial resolution while an upper limit was chosen to exclude galaxies whose angular size 1.1. CHANG-ES PROJECT 5

Figure 1.2: NGC 5457 (also known as the ) as seen in the optical. This is an example of a face-on spiral galaxy. Image Credit: NASA, ESA, K. Kuntz (JHU), F. Bresolin (University of Hawaii), J. Trauger (Jet Propulsion Lab), J. Mould (NOAO), Y.-H. Chu (University of Illinois, Urbana), and STScI. is too large. As the JVLA is an interferometer device it has an upper limit on the spacial scales that can be detected, due to interferometer spacing (Condon and Ransom, 2016). Large galaxies require many pointings and mosaicing in order to image. While some galaxies used in this sample did require these steps the number of pointings was 2 at most. The lower limit on the flux density (S1.4GHz ≥ 23 mJy) was chosen to ensure a detection. Additionally, all galaxies chosen had a declination

(angular position in the sky North/South of the equator) d > −23° to be observable with the EVLA. Three galaxies just outside of these restrictions were also included due to good ancillary data and evidence of extra-planar gas, which we take here to 1.1. CHANG-ES PROJECT 6

Figure 1.3: NGC 4631 (also known as the Whale Galaxy). This is an example of a edge-on galaxy. Total radio intensity at 4.85 GHz is shown as white contours with observations carried out with the Effelsberg Radio Tele- scope and the VLA. Apparent magnetic field vectors perpendicular to the line of sight are shown with their length being proportional to the polarized intensity (100 ≈ 5.5 µJy/beam). Contour levels are given by σ·(−3, 3, 6, 12, 24, 48, 96, 192, 384) with σ is the rms noise of 23 µJy/beam. These are overlayed on an optical Digital Sky Survey (DSS) image. The beam width is shown in the lower left corner and the red x indicated the dynamical center of the galaxy. Image Credit: Mora, Silvia Carolina and Krause, Marita (2013) mean gas that is detected more than 500 pc above the midplane of a galaxy (Wiegert et al., 2015). This choice of galaxies allows us to examine the halo of these galaxies directly, including the physics and structure of outflows for these galaxies. The connection between the galaxy’s disk, halo, and physical environment is also studied through this project. 1.1. CHANG-ES PROJECT 7

Figure 1.4: The VLA is a radio observatory based in central New Mexico. It is com- posed of 27 25-meter radio telescopes joined together to make a large radio interferometer. The CHANG-ES sample made use of this observatory for its data collection. Image Credit: ESA

1.1.1 CHANG-ES Data Products

Products generated from CHANG-ES data take the form of a data cube (see Fig. 1.5). Two of the axes of the cube will be the position axes (i.e. right ascension and declination) while the third is the frequency (or wavelength) of the observation. Each pixel in the data cube will correspond to the intensity measured within the frequency band at that position in the sky. During the imaging of the data a line is fit to the intensity as a function of wavelength for each pixel (see Fig. 1.5). For synchrotron/non-thermal emission, which is the dominant source of emission in a galactic halo, the intensity at a particular frequency band, Iν, is proportional to the

α frequency, ν, to some constant α (i.e. Iν ∝ ν ) and so a linear fit and slope can be 1.1. CHANG-ES PROJECT 8

made to the observed data in log space. Using this fit the intensity at the midpoint of the line can be found and used as the intensity value of the 2D collapsed image. This will be the intensity value measured at each particular pixel and will have a signal to noise ratio equal to that of the whole band, not the individual frequency channel (Condon and Ransom, 2016). In reality there will be an additional (smaller) thermal component that has a much flatter slope that that measured, more detail on this can be found in CHANG-ES theses by Merritt (2019) and Vargas (2017). Table 1.1 summarizes the technical specifications of these measurements. It should be noted that the image is smoothed along the frequency axis so the frequency reso- lution is twice that of the width of the frequency channel. In this thesis the relevant products are the Stokes parameters I, which represents the total intensity of the radio map, the polarized intensity P, and the Rotation Mea- sure RM (see Sect. 1.2 for more details on this). Stokes (1852) first introduced the Stokes parameters I, Q, U, & V as a mathematically convenient way to describe the polarization of an electromagnetic wave. The electric field vector of any monochro- matic wave traveling in thez ˆ-direction (pointing up out of the page) traces an ellipse in thex ˆ andy ˆ directions (see Fig. 1.6). The electric field components in these di-

rections (Ex and Ey, which are time averaged quantities) can be used to define the Stokes parameters

2 2 I = hEx + Ey i

2 2 Q = hEx − Ey i (1.1)

U = h2ExEy cos δi

V = h2ExEy sin δi 1.2. FARADAY ROTATION 9

Frequency Band C-Band L-Band Central Frequency 5.99 GHz 1.57 GHz Bandwidth 2 GHz 0.5 GHz Spectral Resolution 4 MHz 0.5 MHz

Table 1.1: Summary of the technical specification of measurements from the EVLA

where I is the total intensity of the radio map, Q is the linear polarization in the

xy direction, U is the linear polarization shifted by 45°, V is the circularized po- larization, δ is the phase difference between the Ex and Ey fields, and the brackets indicate time averages (Condon and Ransom, 2016). For a completely polarized wave, pQ2 + U 2 + V 2 = I. However, most signals are only partially polarized in which case pQ2 + U 2 + V 2 < I and then the polarized intensity is

p P = Q2 + U 2 + V 2. (1.2)

Note that, except for some compact cores, V is zero.

1.2 Faraday Rotation

Electromagnetic radiation emitted from astronomical objects may often be linearly polarized (henceforth polarized will refer to linear polarization), with the emitted radiation having a preferred orientation. When this polarized light travels through a medium with a magnetic field present, such as a magnetized plasma, the plane of polarization of the light becomes rotated. Linearly polarized light is the sum of left and right handed circularly polarized waves where, in the presence of a background magnetic field, each of the left and right handed waves will have a different index of refraction that causes them to propagate at different phase velocities. This difference 1.2. FARADAY ROTATION 10

Figure 1.5: Visualization of a data cube used to store radio observation data. Image is adapted from Harrison (2016). in phase velocity causes the polarization vector to rotate as the wave travels parallel to a component of the magnetic field along the line of sight. This effect is called Faraday rotation and provides a useful measure of the magnetic field along the line of sight

(Bk) for a radio source (Brentjens and De Bruyn, 2005) (Condon and Ransom, 2016).

A derivation of Faraday rotation demonstrating how it can be used to determine Bk is presented below. 1.2. FARADAY ROTATION 11

Figure 1.6: The electric field vector of a polarized magnetic wave propagating the the zˆ direction (pointing out of the page) is shown. Image Credit: Santos et al. (2012)

1.2.1 Derivation

If the interstellar medium (ISM) contains a magnetic field B~ then non-relativistic electrons will orbit around the magnetic field lines with angular frequency

e|B~ | ωG = (1.3) mec where e is the elementary charge, |B~ | is the strength of the background magnetic

field, me is the mass of an electron, and c is the speed of light, note that this is in cgs units (Condon and Ransom, 2016). This is called the gyrofrequency. The force on an 1.2. FARADAY ROTATION 12

electron due to electric and a steady magnetic field can be written as

e F~ = m ~v˙ = eE~ + ~v ∧ B~ (1.4) e c k

~ where v is the electron velocity, and Bk is the magnetic field parallel to the direction ~ ik~x−iωt of an electron in an electromagnetic wave defined as E = E0e . This wave is travelling in thex ˆ direction (see Fig 1.7,y ˆ andz ˆ correspond to the polarization directions) where k is the wavenumber and ω is the angular frequency of the wave. We also have ~ E ≡ Eyyˆ ± iEzzˆ (1.5)

as the light is circularly polarized. Equation 1.4 a first order differential equation that can be solved to find the electron velocity

eE~ ~v = i( )e−iωt(ˆy ± izˆ). (1.6) me(ω ± ωG)

From here we see that the current density is proportional to the electric field so Ohm’s ~ ~ law applies: J = σE and J = enev where ne is the electron number density. Solving for the conductivity of the medium (σ)

J~ en v ie2n σ = = e = e . (1.7) E~ E me(ω ± ωG)

The wave number, k, can now be found, starting with two of Maxwell’s equations 1.2. FARADAY ROTATION 13

in Gaussian units

−1 ∂B~ ∇~ ∧ E~ = c ∂t (1.8) 4πJ~ 1 ∂D~ ∇~ ∧ B~ = + c c ∂t

where D is the electric displacement field. As the interstellar medium is a near perfect vacuum D~ ≈ E~ . For a plane wave travelling in the x direction ~s = eikx−iωt, where k is the wave number and ω is the angular frequency of the wave. We can apply the operators in equations 1.8 and find

iωB ikE = c (1.9) 4πσE −iωE −ikB = − . c c

Using these to solve for k it can be found that

ω 4πe2n k2 = ( )2(1 + e ). (1.10) c meω(ω ∓ ωG)

This can now be used to determine the index of refraction, n, of the plasma

s 2 ck 4πe ne n± = = 1 + . (1.11) ω meω(ω ∓ ωG)

√ x Using that approximation 1 + x ≈ 1 + 2 for small x we can rewrite n±

2 2πe ne n± = 1 + . (1.12) meω(ω ∓ ωG) 1.2. FARADAY ROTATION 14

From here we can see that there are two different values that the index of refrac- tion can take, one each for the left circularly polarized and right circularly polarized components. It should be noted that, as mentioned above, any polarized wave can be represented as the sum of left and right circularized components. These different indexes of refraction also show that the speed of each of the polarized components are different, causing the polarization vector of the light to rotate as the wave propagates through a medium.

We first find n+ − n− as it will be useful later

2 2 2πe ne 2πe ne n+ − n− = n± = 1 + n± − 1 − (1.13) meω(ω − ωG) meω(ω + ωG)

2πn e2 2ω = e ( G ). (1.14) mω (ω + ωG)(ω − ωG)

The frequency of the EM wave is typically much larger than the angular frequency of the rotating electrons, or ω  ωG meaning that

2πn e2 2ωω n − n = e ( G ). (1.15) + − m ω4

Looking back at n± we see that the left and right circularly polarized light will propagate at different phase velocities. For light moving in the x direction (see Fig. 1.7) the electric field will be given by

ω EL/R(x, t) = E cos( [n x − ct]) (1.16) y 0 c ±

ω EL/R(x, t) = ±E sin( [n x − ct]). (1.17) z 0 c ± 1.2. FARADAY ROTATION 15

Figure 1.7: Diagram showing Faraday Rotation along an axis shown in the top left corner. Image Credit: Adapted from Wikimedia Commons image Faraday-effect.svg

As the wave will be the sum of the left and right circularly polarized components we can add the components together to find the solution for a polarized wave propagating through a magnetized medium. Doing this we find

ω ω E (x, t) = 2E cos( [n x − ct]) cos( [n − n ]x) (1.18) y 0 c ± 2c + −

ω ω E (x, t) = 2E cos( [n x − ct]) sin( [n − n ]x). (1.19) z 0 c ± 2c + −

From here the polarization angle can be determined

E χ = arctan( z ) (1.20) Ey 1.3. ROTATION MEASURE SYNTHESIS 16

ω χ = arctan(tan( [n − n ]x)) (1.21) 2c + − ω χ = [n − n ]x (1.22) 2c + − Z Z 2 dχ 2πnee ωG ∆χ = dx = 2 dx. (1.23) Line of Sight dx Line of Sight mcω

2πc Substituting in equation 1.3 as well as ω = λ where λ is the wavelength of the light

e3λ2 Z ∆χ = 2 4 ne(x)Bk(x)dx. (1.24) 2πm c Line of Sight

This can be written in terms of a rotation measure (RM) so that

∆χ = RM λ2. (1.25)

From here we can see that if the polarization angle χ is measured at multiple λ, then a slope can be determined and Bk can be calculated using an estimate of ne(x) which, in some cases, can be estimated observationally (Condon and Ransom, 2016). The observed polarization angle will be:

2 χ(λ) = RM · λ + χ0 (1.26)

where χ0 is the intrinsic polarization angle.

1.3 Rotation Measure Synthesis

The classical RM definition derived above (see equation 1.24) is valid when there is one background source producing the emitted light with one dispersive Faraday screen causing the Faraday Rotation along the line of sight. This scenario is unrealistic for 1.3. ROTATION MEASURE SYNTHESIS 17

astrophysical observations where multiple emitting plasmas are expected to occur along the line of sight produce the polarized light. To solve this issue the Faraday depth, φ, of a source can be defined following the prescription of Burn (1966) and Brentjens and De Bruyn (2005) who developed and extended the technique to recover extended polarized emission in the Perseus cluster. The Faraday depth can be defined as Z observer ~ φ(x) = 0.81 neB · d~x. (1.27) source

This is equivalent to equations 1.24 & 1.26 and, similarly to these, ne is the electron density in cm−3 , B~ is the magnetic field in µG, and ~x is the line of sight. φ(x) is in units of rad m−2. The factor of 0.81 arises from evaluating the constants found in front of the integral in equation 1.24. Using this definition and following the prescription of Burn (1966) we can write the observed complex polarization vector as

P (λ2) = pIe2iχ (1.28)

where p is the fractional polarization and I is the intensity of light received (therefore pI is the intensity of polarized light received). We can now substitute from equation 1.26 and replace RM with the generalized quantity φ (Heald, 2008)

∞ Z 2 P (λ2) = pIe2i[χ0+φλ ]dφ (1.29) −∞

this can be rewritten in a form similar to that of a Fourier transform

Z ∞ P (λ2) = F (φ)e2iφλ2 dφ (1.30) −∞ 1.3. ROTATION MEASURE SYNTHESIS 18

where F (φ) is known as the Faraday Spectrum or Faraday dispersion function. It describes the polarized flux intrinsic to the source as a function of the Faraday depth (Heald, 2008). We can invert this expression to get

Z ∞ F (φ) = P (λ2)e2πiλ2 dλ2 (1.31) −∞ which describes the intrinsic flux using observable quantities. This equation, however, has no solution as there are no wavelengths less than 0 and not all wavelengths greater than 0 are observed using a telescope. To solve this issue Brentjens and De Bruyn (2005) introduce a weighting function W (λ2) to represent the frequency bandwidth of a telescope. The function has a value of 0 outside the observed wavelengths of a telescope and a nonzero value at wavelengths that are observed. Using this function we find

P˜ = W (λ2)P (λ2) (1.32) Z ∞ 2 2iφ(λ2−λ2) = W (λ ) F (φ)e 0 dφ (1.33) −∞

2 where the factor λ0 has been introduced in order to improve the behavior of the rotation measure spread function to be introduced in equation 1.35, see Heald (2008) and in particular Fig. 1 from this paper for more detail. From this the Faraday dispersion function can be reconstructed as

Z ∞ 2 2πi(λ2−λ2) 2 F˜(φ) = K P˜(λ )e 0 dλ (1.34) −∞ where K is the inverse of the integral over W (λ2). A new function called the RM 1.3. ROTATION MEASURE SYNTHESIS 19

spread function (RMSF or R(φ)), that represents the response of the instrument used in observations, can now be defined

Z ∞ 2 −2iφ(λ2−λ2) 2 R(φ) = K W (λ )e 0 dλ (1.35) −∞ it is equivalent to the point spread function when imaging the sky (Mora-Partiarroyo, 2016). Using this we can rewrite equation 1.34 as

F˜(φ) = F (φ) ∗ R(φ) (1.36)

where ∗ denotes convolution. Brentjens and De Bruyn (2005) then showed that the integrals in equations 1.34 & 1.35 can be approximated as a summation over the frequency channels used to find

N 2 2 X 2 −2iφ(λn−λ0) R(φ) ≈ K W (λn)e (1.37) n=1

N X 2 2 ˜ ˜ −2iφ(λn−λ0) F (φ) ≈ K Pne (1.38) n=1 where subscript n denotes the individual frequency channels in which polarized flux is observed. Applying RM synthesis to a 3D data cube (see Fig. 1.5) will produce another 3D data cube with the two spatial dimensions remaining unchanged while the third frequency channel will be transformed into the Faraday depth. Different sources will appear at different Faraday depths, so that multiple sources can be determined along a line of sight. Sources themselves will have an associated Faraday thickness that is the difference in Faraday depth between the front and back of a source (Burn, 1.3. ROTATION MEASURE SYNTHESIS 20

1966). These sources are considered to be Faraday thin if λ2φ << 1 and are well approximated as a Dirac δ-function. A source is Faraday thick if λ2φ >> 1, and will be extended in φ space. Whether or not a source is Faraday thin or thick is dependant on the wavelength of the observations (Brentjens and De Bruyn, 2005). To determine the Faraday depth of an individual source along the line of sight a parabolic fit is made to the main peak of in the Faraday depth spectrum in order to find the Faraday rotation of the main source. A parabolic fit to the neighbouring data points around the main peak will yield the Faraday depth (Brentjens and De Bruyn, 2005). For the Rotation Measure observations in the CHANG-ES galaxy sample, discussed in Chapters 3 & 4, the main peak in the Faraday depth was adapted as representing the RM of the position in the galaxy of interest. The Faraday depth cube will have limits in the resolution in Faraday space, the largest scale in Faraday depth space to which one is sensitive, and the maximum Faraday depth (Brentjens and De Bruyn, 2005). The maximum resolution in Faraday space that can be achieved can be found as

√ 2 3 δφ (rad m−2) ≈ (1.39) ∆λ2 which is given by the full width at half maximum (FWHM) of the RMSF. The largest scale at which one is sensitive in Faraday depth space is given by

−2 π max scale (rad m ) ≈ 2 (1.40) λmin

which means that if λmin is large then an extended source that exceeds the maximum scale in φ space will instead be resolved as an individual peak. The maximum Faraday 1.4. ORGANIZATION OF THESIS 21

C-Band L-Band # of Channels 16 32 δφ 2065 rad m−2 107 rad m−2 max scale 1691 rad m−2 126 rad m−2

Table 1.2: Maximum resolution in Faraday space (δφ) as well as the maximum scale in Faraday depth space (max scale) for CHANG-ES data at C-Band and L-Band (Mora-Partiarroyo, 2016) depth in which one has more than 50% sensitivity is determined by

√ 3 ||φ || (rad m−2) ≈ (1.41) max δλ2

where δλ is the width of the individual channel used. Table 1.2 lists the maximum resolution in Faraday space as well as the maximum scale in φ space for CHANG-ES data used in this thesis. RM maps were made by averaging together the spectral windows (∆ν = 2 Ghz for C-band data). This was a compromise between the parameters described in Table 1.2 and the signal to noise of the observations.

1.4 Organization of Thesis

The organization of this thesis is as follows: Chapter 2 presents an introduction into the dynamo equations and their solutions as they pertain to the magnetic fields of galaxies, as well as how these solutions were compared to observational results. Chapter 3 presents a submitted journal manuscript that is currently under review. This manuscript details how the dynamo equations are solved under the assumption of scale invariance and presents the results of fitting these solutions to observations of NGC 4631. Chapter 4 presents rotation measure images of other galaxies in the 1.4. ORGANIZATION OF THESIS 22

CHANG-ES survey and summarizes trends seen in the data. Chapter 5 presents a short summary of this thesis. 23

Chapter 2

Preparation For Fitting Dynamo Models

2.1 Dynamos

Dynamo theory is the mechanism by which astronomical objects are thought to gen- erate a magnetic field. It describes the process through which a rotating, electrically conductive fluid can maintain a magnetic field over astronomical time spans. Dy- namo theory is applicable to many astronomical objects including planets and stars. However, for the purpose of this thesis, we will consider only its applications in the magnetic fields of galaxies. This theory makes predictions of the production of ob- served large-scale regular magnetic fields in galaxies. The origin of large-scale galactic magnetic fields is not clear; however prevailing theories are that there was an initial magnetic seed field of primordial origin or created by the Biermann battery (Biermann, 1950) during protogalaxy formation. This initial seed field was amplified by small scale dynamo action due to turbulence in the gas driven by supernovae as well as stellar magnetic fields that may also contribute to the small-scale turbulence generation (Ferriere, 1996). The field was then further amplified to the strength and geometry of magnetic fields observed in nearby galaxies 2.1. DYNAMOS 24

by large-scale dynamo action. The dynamo mechanism transforms mechanical energy into electrical current, which in turn generates a magnetic field. In galaxies the ionized interstellar medium provides a separation of charges needed to produce currents in an overall neutral medium. Alfv´en(1943) showed that magnetic lines are carried along with an imcom- pressible, conducting fluid, as if they are frozen within it. For a compressible gas (i.e. a polytropic gas) the quantity frozen in is the magnetic field, B, over the density, ρ (i.e. B/ρ). This can be used to define the omega (Ω) dynamo effect where a differen- tially rotating body with poloidal magnetic fields (see Fig. 2.1) undergoes shear that will drag the field lines to form a toroidal field. As a galaxy undergoes rotation the magnetic field lines are dragged along with the medium of a galaxy, transforming the magnetic structure. A second dynamo effect called the alpha (α) dynamo is also thought to be present in galaxies. In an alpha dynamo, vertical convective motions are twisted by the Coriolis force which induces an electromotive force. This generates an electric current in the direction of the original field which in turn generates a magnetic loop encircling it. If the conductivity is not perfect then this loop can disconnect and merge with other loops allowing the poloidal field to be rebuilt as well as amplified. The vertical motion can be driven by turbulence from supernovae activity in a galaxy. These two processes constitute the alpha-omega (α − Ω) dynamo action in a galaxy. The amplification of a magnetic field due to the dynamo effect can be described by the mean field dynamo equation (Beck, 2016)

∂B~ = ∇~ ∧ (~v ∧ B~ ) + ∇~ ∧ αB~ + η∇2B~ (2.1) ∂t 2.1. DYNAMOS 25

Figure 2.1: A diagram showing the poloidal (θ) direction in red and the toroidal (φ) direction shown in blue. Image Credit: Dave Burke 2006, Wikimedia Commons where ∇~ ∧ (~v ∧ B~ ) is the induction term, ~v is the large scale velocity, ∇~ ∧ αB~ is the gain term, and η∇2B~ is the loss term. η is the turbulent diffusivity defined as

c2 τ η = + h~v2i (2.2) 4πσ 3 t

2 where σ is the electrical conductivity, τ is the lifetime of turbulent cells, and ~vt is the turbulent velocity squared. α is defined as

τ α = − h~v (∇~ · ~v )i. (2.3) 3 t t 2.2. DYNAMO SOLUTIONS 26

Parameter Physical Interpretation u, v, w Scaled cylindrical velocity components  Fixes rate of rotation of magnetic field in time q Used to define spiral pitch angle. Pitch angle is found as arctan(1/q) T Time variable m Spiral mode C1,C2 Boundary conditions for the magnetic field a Similarity class, defines globally conserved quantity (See table (2.2))

Table 2.1: Physical interpretations of parameters used.

More details on the dynamo equations as well as their solutions in the context of galactic magnetic fields are provided in Chapter 3 of this thesis. Equation 2.1 can be integrated to define the magnetic vector potential A¯ , shown in equation 3.1, this is done as a mathematical convenience and subsequent derivations shown in chapter 3 can be solved starting from either equation 2.1 or 3.1.

2.2 Dynamo Solutions

The solutions to the dynamo equations presented in Chapter 3 contain a number of variables. These variables as well as their physical interpretation are summarized in this subsection as well as shown in Table 2.1. The dynamo equations were solved under the assumption of scale-invariance and both axisymmetric and bisymmetric spiral solutions are searched for. See Fig. 3.2 for an example of axisymmetric and bisymmetric field configurations. The parameter a, found in equation 3.4 which is reproduced below

δT 1/a e = (1 +α ˜dαt) (2.4) 2.2. DYNAMO SOLUTIONS 27

a Dimension of X Possible Identification 0 T q Angular velocity if q = −1 1 Ln/T n Linear velocity if n = 1 3/2 L3n/T 2n Keplerian orbits if n = 1 2 L2n/T n Specific angular momentum if n = 1 3 L3n/T n Magnetic Flux if n = 1

Table 2.2: Self Class Identification aRecall that magnetic field and velocity have the same dimensions when the field is divided by the square root of an arbitrary density. bRecall that, generally, a ≡ α/δ = p/q, where the globally conserved quantity, X, has dimensions [X] = Lp/T q is the ’similarity class’ of the model. This represents the dimensions of a globally con- served quantity that is present in the solutions. A longer discussion of this parameter can be found in Henriksen et al. (2018) as well as Sect. 3.3. A summary of different similarity classes and their possible identifications can be found in Table 2.2 where X is the globally conserved quantity. The parameter m is used to indicate the spiral mode in these solutions, that is the number of spirals appearing in the solution. Solutions for the magnetic field potential A¯ are searched for in equation 3.10 in the complex form A¯ (R, Φ,Z) = A˜ (ζ)eimκ. Face-on RMs can be seen in Fig. 2.2 which shows RMs produced for different values of m when other parameters remain constant. In these figures it can be seen that the number of magnetic spiral arms corresponds to the value of m. The number of reversals in the edge-on case increases with increasing m. However it should be noted that counting the number of reversals alone cannot determine the value of m seen, the spiral pitch angle can also cause the spiral structure to become more tightly or loosely wound causing more or less reversals to be seen in the edge-on case. See Sect. A for more detail. 2.2. DYNAMO SOLUTIONS 28

Figure 2.2: We show face-on RMs for the parameter vector {m, q, , u, v, w} = {m, 2.5, 0.0, 0.0, 0.0, 2.0}. Parameter m has a value of m = 1, 2 in the upper and lower images respectively. The radius, in units of the galactic radii, is shown on the figures. The number of magnetic spirals can be seen increasing in the face-on case, with the number of arms corresponding to the value of m. The scaling shown is arbitrary however red indicates a positive RM (with the magnetic field pointing towards the observer), and blue indicated a negative RM (with the fielding pointing away). 2.3. IMPLEMENTATION 29

Parameters  and q are defined in equation 3.8 where they are used to define rotating logarithmic spiral forms. Parameter q relates to the pitch angle of the solution where the pitch angle can be found as arctan(1/q). A higher q decreases the angle of the magnetic spiral arm. In the edge-on case, a lower q (higher pitch angle) causes the spirals to become more tightly wound and produces more reversals across a RM map. This is effect is illustrated in Fig. 2.3 where q is varied and all other parameters remain constant. The number of reversals seen in the edge-on case depends on both the spiral mode as well as the pitch angle in these solutions. The parameter  fixes the rate of rotation of the magnetic field with time. Varying  results in the rotation of the magnetic field, simulating rotation with time. This is illustrated in Fig. 2.4 where the magnetic structure can be seen rotating as  is increased and all other parameters are held constant. Parameters u, v, w are the scaled cylindrical velocity components where u is in the r direction, v is in the θ direction, w is in the z direction.

2.3 Implementation

One of the main goals of this thesis project was to compare model rotation measure maps that are produced from solutions to the dynamo equations with observational rotation measure maps. Different dynamo models were fit to observations in order to explore if dynamo theory could accurately predict these maps as well as determine what parameter sets provided the best fit. This provides insights into the type of galaxy dynamics (e.g. inflows and outflows of gas to/from a galaxy) that play a crucial role in determining the magnetic field of a galaxy, see Chapter 3 for details and results from this. 2.3. IMPLEMENTATION 30

Figure 2.3: We show face-on RMs for the parameter vector {m, q, , u, v, w} = {1, q, 0.0, 0.0, 0.0, 4.0}. The radius in units of the galactic radii is shown on the figures. Parameter q = 2.5, 4.9 in the upper and lower images respectively. The number of spirals remains constant however becomes more tightly would as q increase. This results in increasing the number of reversals seen in the edge-on case. The scaling shown is arbitrary however red indicates a positive RM (with the magnetic field pointing towards the observer), and blue indicated a negative RM (with the fielding pointing away). 2.3. IMPLEMENTATION 31

Figure 2.4: We show face-on RMs for the parameter vector {m, q, , u, v, w} = {2, 2.5, , 0.0, 0.0, 4} where  = −0.5, +0.5 in the upper and lower images respectively. The radius in units of the galactic radii is shown on the face- on figures and scaling depends on an arbitrary multiplicative constant. The spiral pattern can be seen rotating as  is varied. The scaling shown is arbitrary however red indicates a positive RM (with the magnetic field pointing towards the observer), and blue indicated a negative RM (with the fielding pointing away). 2.3. IMPLEMENTATION 32

The dynamo equations are solved using the mathematical language MAPLE1. Model rotation measure maps are produced from these solutions by integrating along a line of sight through the magnetic field on a pixel by pixel basis. MAPLE scripts written to perform this for different dynamo solutions were provided by thesis super- visor Richard Henriksen. In order to compare these model rotation measure maps to observational maps (in .fits file format) the model solutions had to be converted to the same file format. To perform this file conversion the MAPLE scripts were modified to export model rotation measure images in a .csv file format as well as to systematically export .csv files that cover the parameter space of the solutions. These .csv files were then converted into .fits file format as explained in Appendix B, the code used for this conversion is shown in Appendix D. The dynamo solutions presented in Chapter 3 cover a large parameter space, in order to perform the analysis and to find the solutions that best fit the observational map it was necessary to automate all data analysis. The code used to perform the automated data analysis is shown in Appendix E. To perform the data analysis the model rotation measure maps are converted into .fits format and regridded to match the observational map using a linear interpolation scheme (using the code shown in Appendix D). As the model images depend on an arbitrary multiplicative constant (discussed in more depth in Chapter 3) the images were scaled to match the observational images. To do this a box was selected in the northern halo of the galaxy (see Fig. 3.1) chosen to encompass the systematic RM reversals seen. The observational maps were divided by the modal maps and the median of this new divided map inside the selected region

1www.maplesoft.com 2.3. IMPLEMENTATION 33

was used as a scaling factor. The model map was multiplied by this scaling factor to produce scaled model maps. Once the new scaled model maps were created they were subtracted from the observed RM Synthesis maps of to create residual maps that were then used to deter- mine how well the dynamo field fit the observational results within the given region. If the dynamo field matched the field of the observational map the residual maps would be have a median of 0 rad/m2 and a standard deviation equal to the error in the observations. These quantities inside the selected region in the northern halo as well as a goodness of fit test were used to compare how well different models fit the data. The Akaike information criterion (AIC) was used as a goodness of fit test to es- timate the relative quality of the models. This was implemented using the procedure outlined in Sect. 4 of Erwin (2015), the lower the AIC value the better the model matches the data. More details and results from this work are presented in Chapter 3. 34

Chapter 3

Evolving Galactic Dynamos and Fits to the

Reversing Rotation Measures in the Halo of

NGC 4631

This Chapter as well as App. A constitutes a version of a paper submitted to the Monthly Notices of the Royal Astronomical Society entitled ”Evolving Galactic Dy- namos and Fits to the Reversing Rotation Measures in the Halo of NGC 4631” by authors A. Woodfinden, R.N. Henriksen, J. Irwin, and S.C. Mora-Partiarroyo.

3.1 Abstract

Rotation measure (RM) synthesis maps of NGC 4631 show remarkable sign reversals with distance from the minor axis in the northern halo of the galaxy on kpc scales. To explain this new phenomenon, we solve the dynamo equations under the assumption of scale invariance and search for rotating logarithmic spiral solutions. Solutions for velocity fields representing accretion onto the disk, outflow from the disk, and rotation-only in the disk are found that produce RM with reversing signs viewed edge- on. Model RM maps are created for a variety of input parameters using a Faraday 3.2. INTRODUCTION 35

screen and are scaled to the same amplitude as the observational maps. Residual images are then made and compared to find a best fit. Solutions for rotation-only, i.e. relative to a pattern uniform rotation, did in general, not fit the observations of NGC 4631 well. However, outflow models did provide a reasonable fit to the magnetic field. The best results for the specific region that was modelled in the northern halo are found with accretion. Since there is abundant evidence for both winds and accretion in NGC 4631, this modelling technique has the potential to distinguish between the dominant flows in galaxies.

3.2 Introduction

Recent radio continuum observations of edge-on galaxies have revealed remarkable results. Although large-scale regular magnetic field structures have been observed before in galaxy halos (eg. X-type fields, see Stein et al. (2019a), Krause, M. et al. (2006) and examples below), it is only recently that observational data have allowed us to probe the magnetic field component parallel to the line of sight via rotation measures (RMs) in faint galactic halos. RM synthesis (Brentjens and De Bruyn, 2005) has ensured that the data can be fully exploited to best advantage. The physical quantity of interest is the Faraday depth which is the product of the line of sight component of the magnetic field, Bk, (the ‘parallel’ magnetic field), and the electron density, ne. The parallel field can be positive or negative depending on whether it points towards or away from the observer, respectively1. In Fig. 3.1, we reproduce Fig. 16 from Mora-Partiarroyo et al. (2018) (see also Fig. 6.10 from Mora-Partiarroyo (2016)) showing a Faraday depth map, produced

1See Sect. 2.3 of Stein et al. (2019a) for more details on RMs and how they are determined. 3.2. INTRODUCTION 36

using RM synthesis, of the edge-on galaxy, NGC 4631, which has a strong, well- known halo. In this figure, blue represents negative Faraday depths and red represents positive Faraday depths. Consequently, the direction of the magnetic field weighted and integrated along the line of sight points away from the observer (blue) or towards the observer (red). As can be seen, in the northern halo (on which a box has been drawn) there are regular sign reversals of the Faraday depth as one scans in the east-west direction. These sign reversals are naturally explained by a regular halo magnetic field that is alternating its azimuthal direction on kpc scales in the galaxy. This is a new phenomenon, never before seen in the halo of a galaxy. In the following, we refer to magnetic field reversals when we refer to this obser- vational phenomenon and this paper attempts to explain those reversals (see below). Similar results have been seen in the disk of the face-on galaxy, NGC 628, as shown in Figs. 18 and 26 of Mulcahy, D. D. et al. (2017) and also more recently in the disk of the edge-on galaxy, NGC 4666 (Stein et al., 2019a). For the latter galaxy, the field direction also flips across the major axis of the galaxy. However, prior to the NGC 4631 result, no such phenomenon was seen in galactic halos. Many of the 35 edge-on galaxies observed in the CHANG-ES survey (Irwin et al., 2012) also show clear magnetic field reversals in the Faraday rotation maps and will be the subject of future work. Thus reversing magnetic fields may be a common characteristic of galaxies, although not seen prior to the CHANG-ES survey. A variety of both empirical and dynamo models for the structure of magnetic fields exists; examples include: Sun, X. H. et al. (2008), Jaffe et al. (2010), Jansson and Farrar (2012), Ferri`ere, Katia and Terral, Philippe (2014), and Terral and Ferri`ere (2017). These models recreate magnetic fields in galaxies using various observations 3.2. INTRODUCTION 37

of the Milky Way as well as external galaxies. While these models have had some success, the fits use various inputs that may not necessarily be related to ISM param- eters. They are motivated primarily by observations, but are not derived from first principles. In recent work, authors Terral and Ferri`ere (2017) applied their empirical model to observations of the Milky Way to uncover the large scale magnetic field structure. They found that the magnetic field in the galactic halo is more likely to be bisymmetric than axisymmetric (see Fig. 3.2). This is because their bisymmetric model would show an X-shaped field if viewed externally and edge-on. X type behaviour is well known from previous work for edge-on external galaxies (Tullmann¨ and Dettmar, 2000; Krause, M. et al., 2006; Heesen, V. et al., 2009; Braun et al., 2010; Soida, M. et al., 2011; Haverkorn and Heesen, 2012). It should be noted that the model used by the authors was limited by the assumption that the magnetic field is non-helical when projected on cones. X-shaped magnetic field structures is featured in a wide range of magnetic configurations showing spherical and quasi-spherical geometry (e.g. Brandenburg et al., 1992, 1993). Van Eck et al. (2015) used observations from 20 nearby galaxies to determine sta- tistical properties of galactic magnetic fields and matched these with predictions of galactic dynamo theory. Similar analysis was performed in Chamandy et al. (2016) where pitch angles of observed galaxies are compared to α2Ω dynamos and reasonable agreement is found. Work by Chamandy (2016) and Chamandy et al. (2014) used var- ious approximations such as saturisation of small time-scales to produce approximate solutions that are axisymmetric. 3.2. INTRODUCTION 38

Figure 3.1: Distribution of Faraday depth obtained from C-band VLA (D array) data (Mora-Partiarroyo et al., 2018). Faraday depth was clipped at 5σ of po- larized intensity. All data plotted have an angular resolution of 20.500 FWHM. The maximum error in this figure is about 80 rad/m2 and de- creases to about 20 rad/m2 in areas of high polarization. The red box displays regions showing magnetic reversals in the Northern Halo that is used in the analysis. The median and standard deviation for this region is shown in the label on this figure and this region has a median error of 29.1 rad/m2. This figure was rotated by 5° as per the position angle of NGC 4631 Mora, Silvia Carolina and Krause, Marita (2013). The black lines on this figure show the major and minor axis of the galaxy, note however that there is some curvature to the major axis of this galaxy. 3.2. INTRODUCTION 39

Figure 3.2: Examples of axisymmetric and bisymmetric field geometry.

The well studied dynamo theory (e.g. Klein and Fletcher, 2014, for a brief sum- mary) has made relevant predictions concerning X-type fields (e.g. Brandenburg et al., 1992) in halos and disks of galaxies and sign changes in the halo as a function of height above the disk (Henriksen, 2017a, and references therein). However the theory is largely numerical and so is difficult to apply without intimate knowledge of the appropriate code. In this paper, we replace many assumptions by the one assumption of scale invari- ance. The justification is that complex, self-interacting, dynamical systems frequently develop this symmetry (Barenblatt, 1996; Henriksen, 2015). Moreover this assump- tion allows a relatively simple, semi-analytic, magnetic field description that is a solution of the classical dynamo equations. The ability to search through parameter 3.2. INTRODUCTION 40

space is illustrated by the multiple examples in Appendix A. In this sense we see it as a first step beyond the empirical models. Much of the detailed justification and comparison with earlier work is already included in Henriksen (2017a) and Henriksen, Woodfinden, and Irwin (2018). Using the assumption of scale invariance the classical dynamo equations show again that one can produce X-shaped magnetic fields, establish ‘parity’ changes in a given halo quadrant, and predict the field reversals in galaxy halos, as seen in NGC 4631. The technique is similar to the study of axisymmetric dynamos from Henriksen, Woodfinden, and Irwin (2018). In the current paper we search for gen- eral azimuthal modes and so include both axially symmetric (m = 0) and higher order modes. We find that a combination of axisymmetric and bisymmetric modes (m = 1+, see Fig. 3.2 for the distinction) are required at minimum to fit the various symmetries across quadrant boundaries. There are RM sign reversals in the same quadrant in the pure axially symmetric mode (Henriksen, Woodfinden, and Irwin, 2018, Figs. 1 and 4), but such reversals do not correspond to the multiple regular RM reversals seen in Fig. 3.1. This is strong evidence for the bisymmetric mode (or higher). While such magnetic field geometry has not so far been unambiguously detected in face-on galaxies (Beck, 2016, 2015), Fletcher et al. (2011) found that a bisymmetric spiral mode can fit observations of face-on galaxy M51. In Sects. 3.3 and 3.4, we lay out the relevant theory within a self-similar framework. Fields generated by classical dynamos are derived showing evolving and rotating mag- netic fields with different azimuthal modes. The fields tend to have spiral projections on cones about the minor axis as well as when projected onto the galactic plane. How- ever the combined poloidal and toroidal structure of the field can be quite complex. 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 41

Sample rotation measure (RM) screens for face-on galaxies are also presented. In Sect. 3.5 we fit the RM screens produced by the evolving, scale invariant, magnetic fields to the Faraday rotation map of NGC 4631 seen in Fig. 3.1. We show the best fit results and the magnetic field that produces these fits. Sect. 3.6 presents a comparison with previously published work and in Sect. 3.7 we present our conclusions regarding the fits to NGC 4631. In Appendix A we summarize the important physical results for face-on and edge- on cases. These results will highlight the RM screens produced from a variety of velocity fields (e.g. inflow and outflow for a galaxy). RM screens for both face-on and edge-on cases will be explored.

3.3 Scale Invariant, Evolving, Magnetic Dynamo Spiral fields

We refer to the classical mean-field dynamo equations (Moffatt, 1978) in the form for the magnetic vector potential (Henriksen, 2017a)

∂tA = v ∧ ∇ ∧ A − η∇ ∧ ∇ ∧ A + αd∇ ∧ A. (3.1)

A modern discussion of the limitations of this equation is sumarized in chapter 6 of Klein and Fletcher (2014). Scale invariance provides descriptions of the basic parameters αd, η, and v, but without the detailed physics. Scale invariant solutions are used in this work due to their simplicity, reproducibility, and ability to be easily tested against observational predictions. The solutions contain helicity that is present on all scales, which are coupled in time. It is important in the technical part of what follows to observe that the time derivative in this equation is taken at a fixed spatial point. We do not therefore differentiate the unit vectors. 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 42

In Eqn. (3.1) v is the mean velocity, η is the resistive diffusivity, αd is the magnetic ‘helicity’ resulting from a helical sub-scale magnetohydrodynamic velocity, and A is the magnetic vector potential. The quantity αd may be positive or negative (e.g. Moffatt, 1978, but we take it as positive in this work). Formally, η is the Ohmic diffusivity c2/(4πσ) in terms of the electrical conductivity σ, but it can be interpreted

also as a turbulent diffusivity of the form `vt given a turbulent velocity vt and spatial scale `. The sub-scales associated with the ‘helicity’ and the ‘diffusivity’ may not always be identical. Under the assumption of temporal scale invariance employed here, the amplitude time dependence will simply be a power law or (in the limit of zero similarity class a - see below) an exponential factor. Hence the spatial geometry of the magnetic field remains ‘self-similar’ over the time evolution, and we can therefore study the geometry without requiring a fixed epoch. However our phase dependence includes a rotation in time (see the definition of the variables Φ and κ below), which is an explicit description of ‘rotating magnetic spirals’ in some background frame of reference. Although the global geometry is self-similar, any particular line of sight through the field may detect a different aspect of the spiral structure. The pattern angular velocity of the magnetic arms need not be the same as that of the stellar spiral arms. Indeed Mulcahy, D. D. et al. (2017) show that this is the case observationally. This implies a time dependent phase difference between the two types of arms, which will only occasionally be zero. Should the magnetic spiral pattern speed be equal to that of the stellar arms, a constant phase shift is still possible. Our short hand reference to ‘rotating magnetic spirals’ is slightly misleading, as is our occasional reference to the field being ‘wound on cones’. In fact it is the 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 43

projections of the field on cones symmetric about the galactic minor axis (including the galactic plane as a limiting such cone) that show spiral structure. The three dimensional magnetic field is certainly not constrained to lie solely on cones (neither in fact is the vector potential), as can be seen at lower left in Fig. 3.3 below.

The compatible time evolution of the quantities αd, (and η when that is retained) and the mean flow velocity v is also given by the scale invariance. This removes the necessity of arguing in detail about the physical origin of these quantities although their relative importance is an essential parameter. Ultimately these various time dependences can be used to relate the current field amplitude to a ‘seed magnetic field’, but we leave the restrictions on the value of this seed field to another work. The form of the scale invariance is found following Carter and Henriksen (1991) and Henriksen (2015). We introduce a time variable T along the scale invariant direction according to

αT e = 1 +α ˜dαt, (3.2)

whereα ˜d is a numerical constant that appears in the scale invariant form for the helicity, αd, which form is to be given below. The constant numerical factorα ˜d in Eqn. 3.2 is purely for subsequent notational convenience. The quantity α should not be confused with the helicity as it is an arbitrary reciprocal time-scale used in the scaling. The cylindrical coordinates {r, φ, z} are transformed into scale invariant 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 44

variables {R, Φ,Z}2 according to Henriksen (e.g. 2015)3

r = ReδT , Φ = φ + (/δ + q ln r)δT, z = ZeδT , (3.3)

where δ is another arbitrary reciprocal time-scale that appears in the spatial scaling, and /δ is a number that fixes the rate of rotation of the magnetic field in time. We add q to the arbitrary /δ for subsequent algebraic convenience (see Eqn. 3.8 below). It should once again be emphasized that the quantities {R, Φ,Z} or some combina- tion of these quantities, when used in the dynamo equations guarantee scale invariant solutions (e.g. Henriksen, 2015). They are not to be applied to the geometrical struc- ture of the background galaxy. The implications for the galaxy are through the forms required for the sub-scale helicity and diffusivity, as well as for velocities measured in some reference rotating frame. These can be quite general in spatial form (see e.g. the comment after Eqn. 3.11, but they are reduced to functions of simple radius in this paper. Our theory does not give a value either for the rotational velocity of the magnetic field, , or for the magnetic spiral pitch angle, 1/q. The latter seems to be similar to that of the stellar spiral arms while the magnetic pattern velocity may need consid- erations of outflow such as found in Moss et al. (2013) and Chamandy et al. (2013). In this latter connection if outflow above and below the disk arises from the active star formation part of the stellar arm (backside), then at less than the escape velocity it may lag the stellar arm to fall back somewhere behind the arm. This spiral arm

2The exponential or power law temporal scaling of these variables does not imply that the galactic variables (e.g. galactic radius) are also varying with time. This scaling is only relevant to the dynamo magnetic field. 3We take spatial variables to be measured in terms of a fiducial unit such as the radius of the galactic disk. 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 45

based ‘champagne flow’ will create an amplified magnetic arm where it accretes. This

will be at a phase shift relative to the stellar arm of roughly Ωs d/w where w is the

outflow velocity, d is the radio scale height, and Ωs is the pattern angular velocity of the stellar arm. If the pattern angular speed of the stellar arm is much smaller than w/d, the magnetic arm should lag between multiple spiral arms. In our discussion 1/q > 0 appears as the tangent of the pitch angle of a spiral mode that is lagging relative to the sense of increasing angle φ4. We note from Eqn. 3.2 that

δT 1/a e = (1 +α ˜dαt) , (3.4) where the ‘similarity class’ a ≡ α/δ is a parameter of the model, which reflects the dimensions of a global constant. This quantity is discussed in some detail in Henriksen, Woodfinden, and Irwin (2018), but a simple example is afforded by a global constant GM where G is Newton’s constant and M is some fixed mass. This is the global constant for Keplerian orbits. Continuing with this special example, the space-time dimensions of GM are L3/T 2 and, after scaling length by eδT and time by eαT (Carter and Henriksen, 1991), GM scales as e(3δ−2α)T . To hold this invariant under the scaling we must set α/δ ≡ a = 3/2, which is the ‘Keplerian similarity class’. Note that this ‘class’, that is the ratio 3/2 of the powers of spatial scaling to temporal scaling gives Kepler’s third law, L3 ∝ T 2 for any Keplerian motion. Similarly for a global constant with dimensions of velocity a = 1, while a global constant with dimensions of specific angular momentum requires

4It should be noted that in Henriksen (2017a), q had this role as the normally defined pitch angle with respect to the azimuth. In our examples tan−1(1/q) is typically tan−1(0.4) ≈ 22◦. 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 46 a = 2. A constant angular velocity corresponds to a = 0. A tabular summary is provided in Table 2.2. As is usual in this series of papers we write the magnetic field for dimensional convenience as B b = √ , (3.5) 4πρ so that it has the dimensions of velocity. Here ρ is a constant not associated with the dynamo and indeed might have the value 1/(4π) in cgs units, but it is completely arbitrary. It is in fact absorbed into the multiplicative constants that appear in our solutions. In temporal scale invariance the fields must have the following forms according to their dimensions

A = A¯ (R, Φ,Z)e(2−a)δT ,

b = b¯(R, Φ,Z)e(1−a)δT ≡ e−δt∇ ∧ X,

v = v¯(R, Φ,Z)e(1−a)δT , (3.6) where the barred quantities are the scale invariant fields, which are functions of the three scale invariant variables as defined in Eqns. 3.3. X is the magnetic vector potential A in terms of the scale invariant variables, the cross product should be taken with respect to the scale invariant variables. Eqns. 3.1 can always be written solely in terms of these scale invariant variables (Carter and Henriksen, 1991), so that the temporal scaling symmetry eliminates only the T dependence without additional assumptions. This is multi-variable scale invariance (Henriksen, 2015; Barenblatt, 1996). 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 47

Considering Eqn. 3.6 and Eqn. 3.4 we see that the amplitude time dependence is generally a power law in powers of (1 +α ˜dαt), where the power is determined by the

‘class’ parameter a. Should α = 0 we find from Eqn. 3.4 that δT =α ˜dδt. The field can then grow exponentially according to Eqns. 3.6. The helicity, velocity field and indeed the diffusivity will grow correspondingly. The time scale is controlled by the

value of 1/(˜αdδ), which may be long. The helicity arising from the sub-scale αd, and the resistive diffusivity η, must be written according to their respective dimensions as

(1−a)δT αd =α ¯d(R, Φ,Z)e ,

η =η ¯(R, Φ,Z)e(2−a)T . (3.7)

At this stage a substitution of the forms Eqns. 3.6 into Eqns. 3.1 yields three partial differential equations in the variables {R, Φ,Z}. However, we are seeking non- axially symmetric spiral symmetry in the magnetic fields to match the observations summarized in Beck (2016) and Krause (2012). Any combination of the scale invariant quantities {R, Φ,Z} will render the barred quantities in Eqns. 3.6 scale invariant, so we are free to seek a spiral symmetry by combining them. We choose a combination inspired by our previous modal analysis Henriksen (2017a) and observations of ‘X-type’ fields and magnetic spiral ‘arms’. We assume that the angular dependence may be combined with R in a rotating logarithmic spiral form as (recalling the definition of Φ from Eqn. 3.3)

κ ≡ Φ + q ln R ≡ φ + q ln(r) + T. (3.8)

Moreover we combine the R and Z dependence into a dependence on the conical angle 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 48

through Z ζ ≡ . (3.9) R

The linearity of Eqns. 3.1 allows us to seek solutions in the complex form

A¯ (R, Φ,Z) = A˜ (ζ)eimκ. (3.10)

Note that the variable ζ is time independent. Hence the time dependence of the magnetic dynamo appears only through the amplitude factors in Eqn. 3.6 and through the rotation of the modal pattern contained in the variable κ. On substituting these assumed forms into Eqn. 3.1 one finds that a solution is possible in terms of κ and ζ, provided that the ancillary quantities satisfy

α¯d =α ˜dδR,

η¯ =ηδR ˜ 2, (3.11)

¯v =α ˜dδR {u, v, w}.

The quantities denoted ()˜ and the velocity components {u, v, w} are dimensionless. They may at this stage be functions of the conical angle ζ, but in the absence of definitive observations we keep these constant in this paper. Under these conditions the Eqns. 3.1 become three linear equations for A(ζ),

2 ˜ ˜ ˜ ˜0 ˜ (K + m ∆)Ar − imAz = ( 1 + imq)vAφ − (1 + ζv)Aφ − wbφ ˜0 ˜ ˜0 + ∆(bφ − im[1 + imq)Aφ − ζAφ]) 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 49

2 2 ˜ (K−im v + ∆(1 + m q ))Aφ

˜ ˜0 ˜ ˜ = −u(1 + imq)Aφ + (ζu − w)Aφ + im(wAz + uAr)

˜ ˜0 2 ˜00 + bφ + ∆{ζ(1 − 2imq)Aφ + (1 + ζ )Aφ

˜0 ˜0 ˜ + im[ζAr − Az + (1 − imq)Ar]}

˜ 2 2 ˜ imAr + (K + ∆m (1 + q ))Az

˜ ˜0 ˜ = (1 + imq)Aφ + (v − ζ)Aφ + ubφ

˜0 ˜0 ˜0 ˜0 + ∆{ζbφ − im[Aφ + q(Ar + ζAz)]} (3.12)

Where the prime indicates differentiation with respect to ζ and

K ≡ (2 − a) + im( + v). η˜ ∆ ≡ . (3.13) α˜d

Here ∆ is the inverse of the definition used in Henriksen (2017a) in order to treat it as small when we wish to neglect diffusion. It might be a function of ζ at this ˜ stage. We anticipate a bit by writing the equations with bφ included explicitly (we could of course write the equations entirely in terms of b˜ but then the resulting field is not guaranteed to be solenoidal). This substitution is for brevity, but also because ˜ bφ figures explicitly in our method of reducing the equations. We have set /δ →  so that the latter is now dimensionless. The angular velocity of the magnetic spiral 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 50

pattern is δ. The magnetic field that follows from the curl of the potential takes the form (omitting the power law amplitude factor given in Eqns. 3.6

b˜ b¯ = e(imκ), (3.14) R where ˜ ˜ ˜0 ˜0 ˜0 ˜ b = {imAz − Aφ, Ar + ζAz − imqAz, (3.15) ˜ ˜0 ˜ (1 + imq)Aφ − ζAφ − imAr},

˜ ˜ ˜ ≡ {br, bφ, bz}

Eqns. 3.15, 3.14, and the second of Eqns. 3.6 together give the complete time dependent ˜ magnetic field. In Eqn. 3.15 bφ, as used in Eqns. 3.12, is given explicitly in terms of the vector potential. Eqns. 3.12 are a complicated set of three linear ordinary equations with non con- stant coefficients. In general this is a numerical problem of at least fourth order. However the equations simplify to a second order equation when ∆ = 0. This may be thought of as the zeroth order term in an expansion in ∆, and so we proceed with this special case in this paper. The resulting equations (Eqns. 3.12 with ∆ = 0) reduce to the equations used in Henriksen, Woodfinden, and Irwin (2018) for the axially symmetric temporal case when m = 0. An examination of Eqns. 3.12 with ∆ = 0 indicates that one can rewrite Eqns. 3.12 ˜ as one second order equation for Aφ. The algebra is however formidable. One effective ˜ ˜ procedure is to solve the second equation for bφ in terms of Aφ and its derivatives. Then a substitution into the first and third equations yields two linear equations for ˜ ˜ ˜ ˜ ˜ Ar and Az in terms of Aφ and its derivatives. These can be solved for Ar and Az, 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 51

˜ which are then to be substituted into the form of bφ given in Eqn. 3.15. Finally this ˜ ˜ ˜ now independent expression (Eqns. 3.12) does not know the form of bφ, for bφ(Aφ) is ˜ substituted into the second of Eqns. 3.12 to get a second order equation in Aφ. The resulting equation is rather elaborate in general and we will only use it in various special cases. We give instead the result before the final substitution into the ˜ φ equation of Eqns. 3.12 as the two respective equations for bφ

˜ 2 2 2 2 bφ(K − m (1 + u + w ))

2 2 ˜ = (K − imv)[(K − m + (Ku − imw)(1 + imq))Aφ

˜0 + ((w − uζ)K + im(u + wζ))Aφ], (3.16)

˜ 2 2 ˜0 bφ(K − m (1 + qw) + imqKu) + bφ((K − imζ)w

2 ˜00 − (Kζ + im)u) = −(K − imv)((1 + ζ )Aφ

˜0 ˜ − 2imqζAφ + imq(1 + imq)Aφ). (3.17)

We emphasize that the second equation does not ‘know’ that the combination of potentials from Eqn. 3.15 is in fact the azimuthal field. One must thus exercise caution in using these two equations. Rather than treating them as two equations ˜ ˜ for the quantities Aφ and bφ , the correct procedure is to solve them simultaneously and substitute the first into the second in order to obtain a second order differential ˜ equation for Aφ. The resulting equation is elaborate given a general velocity field as noted above, so that it is more convenient to make the substitution after a particular velocity field has been chosen. ˜ ˜ Subsequently the potentials Ar and Aφ can be found from the first and third 3.3. SCALE INVARIANT, EVOLVING, MAGNETIC DYNAMO SPIRAL FIELDS 52

˜ equations of Eqns. 3.12. After eliminating bφ and setting ∆ = 0 these take the forms

˜ 2 ˜ ˜ (K − imuw)Ar − im(1 + w )Az = [(1 + imq)(v − uw) − w(K − imv)]Aφ (3.18) ˜0 − [1 + vζ + w(w − uζ)]Aφ, and

2 ˜ ˜ 2 ˜ im(1 + u )Ar + (K + imuw)Az = [(1 + imq)(1 + u ) + u(K − imv)]Aφ (3.19) ˜0 + [v − ζ + u(w − uζ)]Aφ.

˜ ˜ Once again we leave the explicit linear solution for Ar and Az for specific cases of the ˜ velocity field. Once these are found in terms of the solution for Aφ (Eqn. 3.17 after substituting Eqn. 3.16), all of the magnetic field components (including the azimuthal ˜ ˜ component in terms of Ar and Az) follow from the expressions in Eqns. 3.15 and 3.14. In Sect. 3.4 we give a series of time dependent examples that are of interest in making qualitative comparisons with observations. One simplification that is apparent from Eqns. 3.18 and 3.19 assumes the vertical velocity to vary on cones according to w = uζ. This does not change Eqns. 3.18, 3.19, or the intermediate equation, Eqn. 3.16, but ˜ the equation, Eqn. 3.17, for Aφ adds the term

(K − imζ)u, (3.20)

˜ to the bracket multiplying bφ.

3.3.1 Boundary conditions

The scale invariance of our solutions does not permit boundary conditions in ζ, al- though the solutions behave fairly naturally there. However the galactic disk is essen- tial to our study and generally it is not recognized by our solutions either. To obtain 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 53

a solution valid for all |z| we must impose a certain symmetry on the solution at the disk that is taken to lie at z = 0. Normally we impose a ‘dipolar’ symmetry (e.g.

Klein and Fletcher, 2014) in which Bz is held continuous across z = 0 but Br and Bφ change sign after crossing z = 0. Formally, that is to embed numerically the boundary condition into the solutions,

Eqns. 3.15 requires for the dipole symmetry that Az change sign across z = 0 while

Ar and Az do not. In addition all derivatives of A should vanish at z = 0. In practice we obtain the lower solution from the upper solution by reflecting the upper solution in the disk plane and changing the sign of the field. This requires a surface current at z = 0 because of the tangential discontinuity. An alternate symmetry is ‘quadrupolar’ symmetry (e.g. Klein and Fletcher, 2014). The upper solution is simply reflected in the disk plane without a sign change. this changes the sign of Bz but not of Br or Bφ. The two sides of the disk are really independent under this symmetry. Formally Eqn. 3.15 now requires Ar and Aφ to change sign while Az does not, and all the derivatives of A to vanish at z = 0, but we proceed with the reflected upper solution to obtain the lower solution. With either of the imposed symmetries, the velocity field must change the sign of its helicity relative to the z axis taken perpendicularly away from the pane on each side. This keeps both the tangential velocity components and the vertical velocity component (thanks to the change in direction of the z axis) continuous across z = 0.

3.4 Generic Scale Invariant Dynamo Magnetic Field Modes

We look at some simple cases in this section that illustrate generic properties. Specific fits to observational data require more extensive parameter searches and multiple 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 54

modes. These are discussed at length in Sect. 3.5 that contains the principal results of this paper. The axisymmetric mode has been discussed in detail in Henriksen, Woodfinden, and Irwin (2018). In Henriksen (2017a) the notion of a uniformly rotating ‘pattern frame’ as the rest frame of the dynamo magnetic field was introduced. The pattern frame may also be the systemic frame of the galaxy, in which case the absolute field rotation would be set essentially by the parameter δ. Generally we may think of this pattern frame of reference as the pattern speed of the gravitational spiral arms, and then δ measures the rotation of the magnetic arms relative to this reference frame. In the previous section we speculated that there would be a lagging phase shift relative to the stellar pattern. This is dependant on there being outflow, and so we use this as the generic case.

3.4.1 Outflow or Accretion in the Pattern Reference Frame

In this section we restrict ourselves to a = 1 and u = v = 0 in the pattern frame. This allows us to study outflow from, or accretion onto, the galactic disk, which is an important observational question. We envisage application in this section to nearly edge-on galaxies, but we also display the existence of magnetic spirals in face-on disks and wound on cones in the halo. The combination of Eqn. 3.16 with 3.17 yields (the algebra can also be carried out ˜ directly from Eqns. 3.12 following the procedure outlined in general above) for Aφ

2 2 ˜00 ˜0 2 2 2 ˜ (1 + w + ζ )Aφ + 2(Kw − imqζ)Aφ + [K − m (1 + q ) − im(w − q)]Aφ = 0, (3.21) where now K = K(a = 1; v = 0) ≡ 1 + im. (3.22) 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 55

This equation is not invariant under a change in sign of ζ and w as we would wish for the solution to apply above and below the galactic disk. We will instead have to reflect the solution at ζ > 0 across the equatorial plane (with a sign change to keep the vertical field continuous) in order to create a symmetrical relation below the disk. We find that both components of the tangential magnetic field must be anti- symmetric across the disk (see also Henriksen, 2017a). The solution is given in terms of hypergeometric functions. We use the MAPLE5 default cuts in the complex plane fore these functions because these are continuous onto the cut from above. There are conditions for the convergence of the hypergeometric series however, With  < 0 these reduce to ζ2 < 3(1 + w2), which normally allows the halo to be covered adequately. The equations for the remaining potentials may be found from Eqns. 3.18 and 3.19 in the explicit forms

2 2 2 ˜ 2 2 ˜ 2 ˜0 [K −m (1+w )]Ar = [im(1+w )(1+imq)−K w]Aφ −(1+w )(K +imζ)Aφ, (3.23) and 2 2 2 ˜ ˜ 2 ˜0 [K − m (1 + w )Az = K[1 + imq + imw]Aφ − [Kζ − im(1 + w )]Aφ. (3.24)

The dynamo magnetic field now follows from Eqn. 3.15. We show some examples with simple parameter choices in Fig. 3.3. In Fig. 3.3 we see a projected bisymmetric spiral magnetic field. In principle the projected spiral structure will continue to the centre of the galaxy, but with finite observational resolution the field might be seen there as a ‘magnetic bar’. The three dimensional field line structure is very markedly distributed in loops over the projected arms. This may be detected in the cube at lower left and is confirmed in Fig. 3.4. At small radius the field lines continue to great heights without looping as is seen on the

5www.maplesoft.com 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 56

Figure 3.3: These images are for the case with only w 6= 0 but positive and a = 1. At upper left the magnetic field vectors are shown on the conical surface ζ = 0.5r, while at upper right the field vectors are shown on a low vertical cut z = 0.15. For both of these images the x axis corresponds to the x direction and the y axis corresponds to the y direction. The radius of the galaxy is at r = 1 in these units. In terms of a parameter vector {m, q, , w, T, C1,C2}, these plots have the vector {1, 2.5, −1, 2.0, 1, 1, 0}. The radius runs over 0.15 ≤ r ≤ 1 in each case. The vector size is a fraction of the average at each point, with the maximum vector 0.5 times the average value. The figure at lower left shows different slices in 3D for the same parameter vector as the previous images, but over the range 0.25 ≤ r ≤ 1. At lower right we show the rotation measure screen in the first quadrant, it should be noted that the scaling on these values is arbitrary and depends on a multiplicative constant. In this image the scaling on the x and y axes is arbitrary, a value of 15 corresponds to the radius of the galactic disk. 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 57 right in Fig. 3.4. The cube at lower left of Fig. 3.3 also shows the field lines pointing towards the minor axis rather than away (Krause, 2012). In fact one normally finds the diverging X-type magnetic field only in the m = 0 dynamo fields (e.g. Henriksen, Woodfinden, and Irwin, 2018; Henriksen, 2017a). The rotation measure (RM) screen is shown in the first quadrant at lower right of Fig. 3.3, but the other quadrants may be generated by imposing anti-symmetry across the plane and either antisymmetry or symmetry across the minor axis depending on odd or even modes. We see that the RM changes sign mainly in radius, which suggests recourse to an m = 0 axially symmetric component to achieve ‘parity inversion’ with height. We note that the magnitude of the outflow velocity is in terms of the turbulent velocity. This may be as high as 50 km s−1. So w = 2 implies only a modest outflow. A value more like w = 5 − 10 would be required to imitate the outflow velocities inferred elsewhere (Heesen et al., 2018). As may be expected, these tend to draw the magnetic field up into the halo and erase the parity change (Henriksen, 2018). In Fig. 3.4 we show on the left a magnetic field line that loops very close to the plane inside the magnetic spiral. The parameters are the same as in Fig. 3.3. On the right we show a field line starting at smaller radii, but otherwise having the same set of parameters as on the left. The field line extends to great heights and crosses over the centre of the galaxy. It is important to note that these are not ‘Parker loops’ arising from Parker instability, but are rather intrinsic to the magnetic dynamo. The magnetic field is in fact stronger and the spirals are better defined under accretion (w < 0) (Henriksen, 2017b). This is demonstrated in Fig. 3.5. Fig. 3.5 shows a dramatic improvement of the projected magnetic spiral structure relative to the outflow results of Fig. 3.3, both at a constant cut in z and projected 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 58

Figure 3.4: The closed magnetic field loop at left is for the same parameter set as in the previous figure for a = 1 and only w 6= 0. It begins at {r, φ, z} ={0.5, 0, 0.001} and returns to the plane after looping in the spiral arm. The loop is very close to the plane with maximum at perhaps 60 pc. The field line on the right is also for the same parameter set, but it begins closer to the centre at {r, φ, z} ={0.25, 0, 0.001}. We see that this line descends (the field line is pointing downwards) from great heights while crossing over the centre of the galaxy. The x, y, and z axes correspond to thex, ˆ y,ˆ andz ˆ directions respectively in units of the radius of the galactic disk. onto the face of a cone. At lower left we show a poloidal section at φ = π/4 for the same accretion parameters. The field again loops above the disk, crossing over the centre of the galaxy (we have checked that the field at φ = 5π/4 has the opposite sign). The projected magnetic field is not ‘X-shaped’. We have not corrected for the internal Faraday rotation of the locally produced emission in the presumed projections. The RM screen for the same accretion case is shown at the lower right of the Fig. 3.5. Although the amplitudes vary considerably, most of the high halo is of uniform sign. the strong RM extends to greater heights than with the outflow. Near the plane and near the minor axis there is a strong sign change. Rapid variation 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 59

Figure 3.5: The image at upper left of the figure shows a cut through the halo at z = 0.15. The vertical velocity is −2 so that there is accretion onto the disk. The other parameters are the same as in Fig. 3.3, including the range of radius and a = 1. The x and y axes correspond to thex ˆ andy ˆ directions respectively. At upper right we show the spiral structure on the cone ζ = 0.25r over the same range in radius and same directions. Once again the only change is that the vertical flow is now inflow with w = −2. At lower left we show a poloidal section at φ = π/4. At lower right we show the RM screen for accretion (w = −2) with the same parameters otherwise, it should be noted that the scaling on these values is arbitrary and depends on a multiplicative constant. In this image the scaling on the x and y axes is arbitrary, a value of 15 corresponds to the radius of the galactic disk. 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 60

Figure 3.6: The figure shows the RM screen in the first quadrant for the parameter set {m, q, , w, T, C1,C2}={2, 2.5, −1, −2, 1, 1, 0} in the left panel. Scaling in arbitrary and depends on a multiplicative constant. The sign change is now more frequent. In this image the scaling on the x and y axes is arbitrary, a value of 15 corresponds to the radius of the galactic disk. The right panel is a cut at z = 0.15 over the radial range {0.1, 1} for the same parameters, except that q = 1. The x and y axes correspond to the xˆ andy ˆ directions respectively. in the magnetic field is also detectable in the poloidal section at lower left of the figure. A detailed Faraday depth model would require assuming the distribution of the relativistic electrons and ideally, performing RM synthesis (or the equivalent). We are only calculating an RM screen, due solely to the magnetic field structure while assuming a constant electron density. Should both of these increase strongly with decreasing radius, our calculation mainly reflects conditions near the tangent point of the line of sight to a given circle in the disk. In Fig. 3.6 we show on the left the higher order mode m = 2 for otherwise the same parameters as the accretion case in Fig. 3.5. On the right we show the magnetic projected spiral structure for m = 2 and q = 1, a much larger pitch angle. 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 61

The RM screen is more structured because of the increased number of magnetic spirals in projection. The RM sign reversals continue from the disk into the halo although much of the activity is at small ζ (but moderate height). This type of oscillation in the RM was predicted in Henriksen (2017a) for modal solutions, and is confirmed here. The lack of resistivity in this analysis has not changed this behaviour very much, and so this behaviour may be generic to self-similar symmetry. On the right hand panel of the figure we show a cut of the same example with accretion, but with a 45◦ pitch angle. This may be compared to the upper right panel in Fig. 3.5 with pitch angle 21.8◦. Similar behaviour is shown in the lower right panel of Fig. 1 in Henriksen (2017a), but again for pitch angle 21.8◦. Although we have made no attempt at a proper fit, these figures show a resemblance to the observations of NGC 4736 reported in Fig. 2 of Chy˙zy and Buta (2008). The current example is for the class a = 1 with infinite conductivity, while the example in Henriksen (2017a) contains finite resistive diffusion and is for the similarity class a = 2. The velocity field, helicity and diffusion (in Henriksen, 2017a) all have global variations consistent with the specified a. This particular galaxy is unique only in that it shows a two-armed mode extending well into the galactic centre independent of gravitational spirals. Many similar cases of magnetic spirals exist (Beck, 2016; Wiegert et al., 2015). It is not obvious how the spiral arm pattern will be intersected by the line of sight (los). In our figures we have taken it to lie at about −90◦ to the x axis. In Fig. 3.7 we illustrate the changes that may be produced by this degree of freedom. We actually rotate the field pattern relative to the line of sight direction, which may be taken at the bottom of each figure. Fig. 3.7 shows the effect of rotating a spiral pattern relative to the los. This will 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 62

Figure 3.7: The figure on the top is a cut through the solution of Fig. 3.3 at z = 0.25 but with {m, q, , w, T, C1,C2} = {1, 2.5, 0, 2, 1, 1, 0}, so that it has been rotated clockwise through one radian relative to the figure at upper right in Fig. 3.3 (which is also at a slightly lower cut z = 0.15). The figure in the middle has been rotated counterclockwise through 45◦ relative to that at upper left in Fig. 3.3, while the bottom figure has been rotated counter clockwise through 90◦. The line of sight is from the bottom of each figure. The x and y axes in these figures correspond to thex ˆ andy ˆ directions. 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 63 appear strongly in the structure of the RM screen, which we do not include explicitly here for brevity. However the qualitative differences between the three cases in the integration of the parallel field along each los starting from the bottom, is evident by eye. Explicit examples are given in Appendix A.

3.4.2 RM Screen for Face-on Galaxies

The previous section has demonstrated the existence of projected magnetic spirals in the disk and halo of a galaxy with an operating classical dynamo. These have been observed using the polarized emission from face-on and edge-on disks. However it is becoming common place to give the Faraday depth by RM synthesis for nearly face-on galaxies (e.g. Beck, 2015; Mulcahy, D. D. et al., 2017). Thus in this section we give a preliminary RM screen analysis of essentially the same model used in the previous section. We continue to hold the electron density constant but if this quantity is determined observationally, a direct comparison with Faraday depth measurements will be possible. We take a simple case where the axially symmetric stellar galaxy is inclined at a small angle i to the line of sight (los), and the x axis in the galaxy is taken per- pendicular to the los pointing along the major axis to the west (north up). This simplification produces a glitch in our calculations at φ = π/2, 3π/2 but the plotting routine is able to smooth out this effect. Just as in Fig. 3.3 we take  = −1 so that the magnetic pattern is rotated counter-clockwise by one radian. This is of no real consequence here since we calculate the RM screen over 2π radians. We use cylindrical coordinates relative to the minor axis of the galaxy to describe the magnetic field. These are the set {r, φ, z} at the top surface of the disk/halo, 3.4. GENERIC SCALE INVARIANT DYNAMO MAGNETIC FIELD MODES 64

which is taken to be a cylinder of height h and radius equal to that of the disk (taken to be 1). Along the line of sight (d` starting from ` = 0 at the top) we must calculate the new cylindrical coordinates {R(`), Φ(`),Z(`)} to obtain the los magnetic field. This field is (taken positive along the los towards an observer - written here for the third or fourth quadrant)

blos = −br(R(`), Φ(`),Z(`)) sin (Φ(`)) sin (i)

− bφ(R(`), Φ(`),Z(`)) cos (Φ(`)) sin (i)

+ bz(R(`), Φ(`),Z(`)) cos (i), (3.25) where

2` `2 R(`) = r[1 + sin(φ) sin (i) + sin (i)2]1/2, r r2 r sin (φ) + ` sin (i) Φ(`) = arctan ( ), r cos (φ) Z(`) = h − ` cos (φ). (3.26)

Our calculations are done at small enough radius and inclination that we do not worry about edge effects. In Fig. 3.8 we show on the left the integration of the magnetic field along the los over 2π radians for a m = 2 mode. Because in these models the field tends to loop over the polarization arms, the RM maxima tend to be between and on the edges of the polarization arms. The figure on the right shows the RM over the galactic plane in spherical polar coordinates. The spiral structure need not coincide with the polarization arms, although with the presence of the m=0 mode it may. By comparing 3.5. FIT TO NGC 4631 65

the bottom two panels of the figure for the pure m = 2 mode, we infer that the central magnetic polarization arms are traced largely by the lines of nearly zero RM (light green colour in the figure). Moreover it appears that the RM is negative on the inside of a polarization arm and positive on the outside of the arm. But this is highly model dependent and can be reversed by reversing the sign of multiplicative constants. In Appendix A we outline the observational expectations that result from system- atically varying the parameters outlined in Sects. 3.3 & 3.4. We also summarize the physical interpretation of these parameters. Similar face on magnetic behaviour may already have been detected in IC342 (Beck, 2015). Other face on examples from our models are presented in Appendix A.

3.5 Fit to NGC 4631

In this section we will fit RM screens generated from these dynamo models to the Faraday RM map of NGC 4631 by Mora-Partiarroyo et al. (2018). This galaxy hosts one of the largest and brightest known galactic halos (Wang et al., 2000; Wang et al., 2001) thought to be partly caused by gravitational interactions with neighbouring galaxies NGC 4565 and NGC 4627 (Hummel et al., 1988; Mora, Silvia Carolina and Krause, Marita, 2013). This merger is likely to have caused a starburst in the past leading to an outflow from this galaxy (Irwin et al., 2011). This is a edge-on galaxy at an inclination of 89° ± 1° and an assumed distance of 7.6 Mpc (Mora-Partiarroyo et al., 2018). Details of the observations and reductions used to create Fig. 3.1 can be found in greater detail in Mora-Partiarroyo et al. (2018) and are briefly summarized below. 3.5. FIT TO NGC 4631 66

Figure 3.8: On the left of the figure we show the face-on RM for the parameter vector {r, i, h, m, q, , w, T, C1,C2} = {0.25, 0.12, 0.5, 2, 2.5, −1, 2, 1, 1, 0}. That is a radial cut at r = 0.25 over 0 ≤ φ ≤ 2π. The figure on the right shows in galaxy polar coordinates the RM integrated over the face of the galaxy with the same parameters as on the left. At lower left we show a cut along the los at ` = 0.25 for the same parameter set, where the x and y axes correspond to thex ˆ andy ˆ directions respectively, and at lower right we show the RM screen integrated over the face of the galaxy but in rectangular {r, φ} coordinates. The top of the figure fits smoothly on to the bottom of the figure and spiral structure is represented as inclined straight lines in the outer disk. The radius in the solution shown extends from 0 to 1 galactic radii and the angle extends from 0 to 2π. Note that the colour bars at upper right and lower right are not the same and scaling is dependant on an arbitrary multiplicative constant. 3.5. FIT TO NGC 4631 67

Observations were taken using the Karl. G. Jansky Very large Array (VLA) at C- band and L-band. C-band data were selected as this is the only band at which one can expect to trace a large enough line of sight through the galaxy. A map of the Faraday depth at a resolution of 20.500 is created as shown in Fig. 3.1 of this paper. The mid plane of the galaxy is completely depolarized and the median error in the region used for analysis is 29.1 rad/m2. The Faraday rotation due to the galactic foreground is negligible in the direction of NGC 4631, Heald, G. et al. (2009) found the galactic foreground to be −4 ± 3 rad/m2 and Oppermann et al. (2012) found a value of −0.3 ± 2.7 rad/m2. Thus, the RM shown in Fig. 3.1 are intrinsic to NGC 4631. Heesen et al. (2018) looked at NGC 4631 as part of a sample of 12 galaxies. They

−1 found a rotational velocity of vrot = 138 km s (Makarov et al., 2014) leading to √ −1 an escape velocity of vesc = 2vrot = 195 km s , where this is the escape velocity near the mid plane of the galaxy. By fitting 1D cosmic ray transfer models they

+80 −1 +50 −1 found an advection speed of 300−50 km s in the northern halo and 200−30 km s in the southern halo. These values were typical of the other galaxies sampled. The advection speed in the northern halo is clearly greater than the escape velocity and a net outflow from this galaxy is expected. Due to different advection speeds in the northern and southern halos the dynamo solutions with the best fits are not expected to be the same above and below the disk. The goal of fitting the dynamo solutions to the data is to explain the reversing sign of the RM seen in the northern halo of NGC 4631. To do this a box is placed around the desired region as can be seen as the red box in Fig. 3.1. This box is chosen to encompass all of the reasonably regular reversals seen in the northern halo. The uncertainty in the measurements is higher near the edges of the available data so the 3.5. FIT TO NGC 4631 68

box is chosen to minimize this effect. There is a strong reversal on the right of the halo seen as a dark blue patch in Fig. 3.1, the strength of this reversal is several times higher than seen in other reversals and its shape is noticeably more rounded. This reversal may not be due to the large scale field and may instead be another effect showing up in the rotation measure map such as a bubble. As a precaution the box is chosen to avoid this region. The dynamo solutions are regridded to match the RM Synthesis map of NGC 4631. The dynamo solutions are solved for up to one galactic radius on the major axis and one half galactic radius on the minor axis, the dynamo maps are resized to match NGC 4631 and properly centred to the galaxy. As mentioned in Sects. 3.3 & 3.4 the dynamo solutions contain an arbitrary multiplicative constant that makes the strength of the magnetic field arbitrary. To be able to fit these maps to the observation, the maps must be scaled to be an appropriate amplitude. To do this the region inside the box selected in the northern halo of the galaxy is taken from both the observational and theoretical maps and the observation maps are divided by the theoretical maps. The median of this new divided region is taken and used as a scaling factor. The theoretical map is multiplied by this scaling factor. This produces a new scaled dynamo map to match the scaling on NGC 4631. Once the new scaled dynamo maps have been created they are subtracted from the observed RM Synthesis maps of NGC 4631 to create residual maps that are then used to determine how well the dynamo field fit the observational results within the given region. If the dynamo field matched the field of NGC 4631 the residual maps would be have a median of 0 rad/m2 and a standard deviation equal to the error in the image (29.1 rad/m2). These quantities as well as a goodness of fit test are used 3.5. FIT TO NGC 4631 69

to compare how well different models fit the data. The Akaike information criterion (AIC) is used as a goodness of fit test to estimate the relative quality of the models. This is implemented using the procedure outlined in Sect. 4 of Erwin (2015), the lower the AIC value the better the model matches the data. AIC is an estimator that can be used to determine the relative quality of a model for given data. AIC estimates the quality of each model relative to other models given. Thus, AIC provides a method for determining which model best represents the data. In order to determine the best fit dynamo and parameters a parameter search was done by calculating the dynamo solution for a large parameter space and then comparing each of these results to the observational map using the procedure out- lined above. For the outflow and accretion models the parameter q was varied with the following values q = {0.0, 1.0, 2.5, 4.9, 11.5} corresponding to pitch angles of {90°, 45°, 22°, 13°, 5°}. The parameter w was varied with the following values w = {2, 3, 4, 5, 6} for the outflow case and the negative of these for the inflow case. These values represent expected inflow and outflow velocities. The rotation parameter  was varied with the following values  = {−1.0, −0.5, 0.0, 0.5, 1.0}. The parameter m was varied with the following values m = {0, 1, 2} chosen to cover the first 3 possi- ble modes. For pure rotation in the pattern frame the parameters q, , m were varied in the same manner as in the outflow/accretion cases. The parameter w was set to 0 by requirement for the model. The parameter a was varied with the following values a = {0, 1, 2} (see Table 2.2). From this parameter space the best results are shown in Table 3.1. These results were chosen because they are the only solutions which cause the standard deviation of the residual maps to be lower than the observational result. As can be seen from 3.5. FIT TO NGC 4631 70

Model Case Parameter Vector Median Standard Deviation AIC 1 Outflow {m, q, , u, v, w}={2, 2.5, 0.5, 0.0, 0.0, 3.0} 32.31 75.01 5909 2 Outflow {m, q, , u, v, w}={2, 2.5, 0.5, 0.0, 0.0, 4.0} 7.20 71.39 4062 3 Outflow {m, q, , u, v, w}={2, 2.5, 0.5, 0.0, 0.0, 5.0} -5.27 70.26 3707 4 Inflow {m, q, , u, v, w}={1, 4.9, −1.0, 0.0, 0.0, −5.0} 11.51 82.12 4105 5 Inflow {m, q, , u, v, w}={2, 2.5, 0.5, 0.0, 0.0, −2.0} 18.80 75.48 3308 6 Inflow {m, q, , u, v, w}={2, 2.5, −1.0, 0.0, 0.0, −3.0} -28.47 72.30 3465 7 Inflow {m, q, , u, v, w}={2, 2.5, 0.5, 0.0, 0.0, −3.0} 14.32 69.15 2862 8 Inflow {m, q, , u, v, w}={2, 2.5, −1.0, 0.0, 0.0, −4.0} -25.12 65.09 2785 9 Inflow {m, q, , u, v, w}={2, 2.5, 0.5, 0.0, 0.0, −4.0} 11.17 68.00 2818 10 Inflow {m, q, , u, v, w}={2, 2.5, −1.0, 0.0, 0.0, −5.0} -19.65 61.08 2445 11 Inflow {m, q, , u, v, w}={2, 2.5, 0.5, 0.0, 0.0, −5.0} 12.56 67.94 2869 12 Rotation-Only {a, m, q, , u, v, w}={0, 1, 4.9, −1.0, 0.0, 1.0, 0.0} -34.43 81.51 5191 13 Rotation-Only {a, m, q, , u, v, w}={0, 2, 1.0, −1.0, 0.0, 1.0, 0.0} 88.38 75.39 10262 14 Rotation-Only {a, m, q, , u, v, w}={1, 2, 2.5, 1.0, 0.0, 1.0, 0.0} 74.63 84.38 9272

Table 3.1: Results of solutions where the standard deviation of the residual maps was less than the standard deviation of the NGC 4631 RM map in the speci- fied box from Fig. 3.1, indicating a good fit. No mixing of different modes was allowed in this table and the mode number is specified in the param- eter vector. Left most column indicates the type of solution (inflow-only, outflow-only, or rotation-only). The parameter vector for each solution is shown in the column second from the left. The next right two columns indicate the median and standard deviation for the desired box in the so- lutions (see Fig. 3.1). The rightmost column shows the AIC indicating the goodness of fit for the models. this table more accretion and outflow solutions cause the residual maps to be closer to zero than rotation-only solutions. These solutions, in general, also cause the standard deviation to be lower and have a lower AIC than the pure rotation cases. We can also combine different modes from the same dynamo models (with the same parameter set) together to create a new map to fit the observational results. These maps do not have to be the same magnitude and the amplitude of each mode can be varied to account for certain modes being dominant. The spiral pitch angle is also an additional degree of freedom that can be varied for the different modes however for this analysis it is assumed to be consistent between them. In order to test these maps we take the parameter sets from Table 3.1 and allow the m = 0, 1, 2 modes 3.5. FIT TO NGC 4631 71

Model Case Parameter Vector Median Std AIC Mode Amplitudes Dev m = (0, 1, 2) 1m Outflow {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, 3.0} -17.56 76.86 4331 (-0.1,0,0.5) 2m Outflow {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, 4.0} -2.3 69.21 3771 (-0.1,-0.1,2.0) 3m Outflow {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, 5.0} -23.41 70.87 3535 (-0.5,-0.5,2.0) 4m Inflow {m, q, , u, v, w} = {m, 4.9, −1.0, 0.0, 0.0, −5.0} -6.84 53.7 2082 (-0.1,1.5,1.5) 5m Inflow {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, −2.0} 16.17 74.74 3262 (0,0.001,0.1) 6m Inflow {m, q, , u, v, w} = {m, 2.5, −1.0, 0.0, 0.0, −3.0} -6.11 74.45 3253 (0.1,0,1.0) 7m Inflow {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, −3.0} 14.47 69.13 2859 (0,0.001,0.5) 8m Inflow {m, q, , u, v, w} = {m, 2.5, −1.0, 0.0, 0.0, −4.0} -14.83 66.04 2623 (0.1,0,2.0) 9m Inflow {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, −4.0} 17.01 67.74 2800 (-0.001,0.1,2.0) 10m Inflow {m, q, , u, v, w} = {m, 2.5, −1.0, 0.0, 0.0, −5.0} -5.94 62.77 2346 (0.1,0,1.5) 11m Inflow {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, −5.0} 16.06 67.22 2803 (-0.001,0.1,1.5) 12m Rotation-Only {a, m, q, , u, v, w} = {0, m, 4.9, −1.0, 0.0, 1.0, 0.0} -33.53 81.17 4994 (-2.0,0.1,0) 13m Rotation-Only {a, m, q, , u, v, w} = {0, m, 1.0, −1.0, 0.0, 1.0, 0.0} -1.53 101.19 7769 (-2.0,0.1,-0.1) 14m Rotation-Only {a, m, q, , u, v, w} = {1, m, 2.5, 1.0, 0.0, 1.0, 0.0} -26.46 80.36 5232 (-0.5,0.001,0.001)

Table 3.2: Results of solutions where the standard deviation of the residual maps was less than the standard deviation of NGC 4631 (from Fig. 3.1) in the spec- ified box for the no mixing case. Mixing of different modes was allowed in this table. Left most column indicates the type of solution (inflow-only, outflow-only, or rotation-only). The parameter vector for each solution is shown in the column second from the left. Columns 3 & 4 indicate the median and standard deviation for the desired box in the solutions (see Fig. 3.1). The rightmost column is the amplitudes fo the m = 0, 1, 2 modes respectively. Note these combinations are then rescaled to NGC 4631 be- fore creating the residual map. to mix. To do this we create another large parameter space where the amplitudes of each of these modes is varied from the following values: {−2.0, −1.5, −1., −0.5, −0.1, −0.001, 0., 0.001, 0.1, 0.5, 1., 1.5, 2.0}. The new maps created from these modes are then compared to the observational maps with the same procedure as above to determine the best fits. This is done and best results are shown in Table 3.2. We show the parameter vector, median, and standard deviation within the reversal region in the northern halo, and the combined amplitudes that provide the lowest AIC value. As can be seen, the outflow/inflow solutions again perform considerably better than the rotation-only results. 3.5. FIT TO NGC 4631 72

The outflow solutions were improved through the combinations of different modes. The best outflow model without combining modes was model 3 with the parameter vector {m, q, , u, v, w} = {2, 2.5, 0.5, 0.0, 0.0, 5.0} which is a solution with moderate outflow wind speeds relative to other solutions. The solution with the best fit that combines several modes is model 3m with parameter vector {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, 5.0} where we combined 3 modes (m = 0, 1, 2) with scaling factors (−0.5, −0.5, 2.0) respectively. This fit is shown in Fig. 3.9. Note that once combined the solutions are rescaled to match the observed map in the method described above. This solution has a moderate outflow velocity and the magnetic spirals have a pitch angle of 22°. A pitch angle of 22° is typical and velocities are in units of the subscale turbulent velocity. A turbulent velocity value must be adopted to convert to physical units and a value of 50 km s−1 leads to an outflow velocity of ∼ 250 km s−1 for w = 5. This compares favourably to the measured outflow velocity for NGC 4631 by Heesen et al. (2018) and is within the error range of their value. The accretion solutions provide the best fit to the maps of NGC 4631 and an improvement to these fits is also seen when different modes are combined. As can be seen, the lowest standard deviation and AIC is provided from model 4m with parameter vector {m, q, , u, v, w} = {m, 4.9, −1.0, 0.0, 0.0, −5.0} and has scaling factors for the m = 0, 1, 2 modes of (−0.1, 1.5, 1.5). This solution is seen in Fig. 3.10. This is a solution that has a moderate to strong inflow velocity and magnetic spirals with a pitch angle of 11.5°. The strongest modes are m = 1, 2 however the m = 0 mode is present and non-negligible in the fit. These results show that the magnetic field of NGC 4631 can be well fit by scale invariant dynamo solutions with either accretion or outflow onto/from the galaxy. 3.5. FIT TO NGC 4631 73

Figure 3.9: We present an outflow-only solution that best matches the observed map of NGC 4631. The scaled solution is shown on the left and the corre- sponding residual map is shown on the right corresponding to model 3 in Table 3.1. Red box displays regions showing magnetic reversals in the Northern Halo of NGC 4631 that is used in the analysis. The median and standard deviation for this region is shown in the label on this figure. This solution is obtained with the parameter vector {m, q, , u, v, w} = {m, 2.5, 0.5, 0.0, 0.0, 4.0} where we combined 3 modes (m = 0, 1, 2) with scaling factors (−0.5, −0.5, 2.0). Once combined the solutions are rescaled to match the observed map in the method described in Sect. 3.5. Note the change of scale between the two figures. The x and y axes correspond to Right Ascension and Declination of the observational map, the units shown is in terms of the pixel number.

Well fit is taken here to represent a solution in which the standard deviation of the residual map is lower than that in the observational map. This model in its present form imposes various constraints such as assuming accretion or outflow is proportional to the radius throughout the galaxy, the electron density is constant through the galaxy, and only large scale magnetic fields are seen in the observations, etc. Despite these scale invariant requirements the magnetic field of NGC 4631 using the RM maps of the galaxy was well described by RM maps of dynamo models. Dynamo solutions for rotation-only cases did, in general, not fit the observations of NGC 4631. 3.5. FIT TO NGC 4631 74

Figure 3.10: We present an inflow-only solution that best matches the observed map of NGC 4631. The scaled solution is shown on the left and the corre- sponding residual map is shown on the right corresponding to model 4m in Table 3.2. The red box displays the region showing magnetic rever- sals in the Northern Halo of NGC 4631 that is used in the analysis. The median and standard deviation for this region is shown in the label on this figure. The solution is obtained with the parameter vector {m, q, , u, v, w} = {m, 4.9, −1.0, 0.0, 0.0, −5.0} where we combined 3 modes (m = 0, 1, 2) with scaling factors (−0.1, 1.5, 1.5). Once combined, the solutions are rescaled to match the observed map in the method de- scribed in Sect. 3.5. Note the change of scale between the two figures. The x and y axes correspond to Right Ascension and Declination of the observational map, the units shown is in terms of the pixel number.

The fact that inflow and outflow models are quite similar makes it difficult to dis- tinguish between the two (see Appendix A.1). Nevertheless, there is a clear although marginal preference for our data to be better fit by infall models. This result was unexpected since many authors have argued for winds from NGC 4631 as well as other galaxies (Heesen et al., 2018; Hummel and Dettmar, 1990; Mora, Silvia Carolina and

Krause, Marita, 2013; Tullmann,¨ R. et al., 2006, and others). The difference may be due to the restricted range over which our fits were car- ried out. However, we note that the environment of NGC 4631 shows considerable 3.6. COMPARISON WITH PREVIOUS MODELS 75

complexity because of the well-known interaction with the galaxies NGC 4656 and NGC 4627. Numerous HI spurs and tidal features are seen connecting these systems and there is also strong evidence for infalling gas (for example, see Combes, 1978; Stephens and Velusamy, 1990; Rand, 1994; Richter et al., 2018). Our models therefore have the potential to provide an important discriminator be- tween such scenarios especially as data improve and more such systems are observed.

3.6 Comparison with Previous Models

X-shaped fields are seen in many edge-on galaxies (see Sect. 3.2) and are predicted here for the m = 0 mode, as well as in much earlier work (Brandenburg et al., 1992, 1993). The latter two papers cited contain many of the same effects that we have found, although in axial symmetry. In Brandenburg et al. (1992) the dynamo equations are integrated numerically in space and time using rather detailed assumptions regarding wind and rotational velocities, alpha effect and diffusivity. Moreover they introduce dynamo action in the halo much as do we. A significant result compared to our own findings is the complex variation with time and angle of the RM, when projected onto the galactic plane as in our Sect. 3.4.2. This is shown in their Fig. 5; the structure varies in time much as would our fields due to pattern rotation. These authors also suggest complex parity structure in the halo, but they do not show the RM predicted for edge-on galaxies. In Brandenburg et al. (1993) the same type of integration is used to produce X-type fields in the halo in axial symmetry (their Figs. 8b, 8c). It should be noted that we agree that the m = 0 mode is required to produce the X-type fields. 3.6. COMPARISON WITH PREVIOUS MODELS 76

The assumption of scale invariance that we use has the following advantages com- pared to the earlier insightful work. It offers a coherent assumption for the alpha effect in the halo, for diffusivity, and for rotational and wind velocity, which are not grossly unphysical. Because this assumption renders the solutions semi-analytic, they can be used relatively straightforwardly to fit observations as we have shown. Moreover scale invariance is a commonly occurring symmetry in complex systems and likely to be true in galaxies as the various global scaling relations (e.g. Tully-Fisher, and even the X-ray behaviour in clusters of galaxies) attest. The agreement in qualitative behaviour between the scale invariant model and that based on numerical integration and detailed physical assumptions, is reassuring. It suggests that the qualitative behaviour is somewhat insensitive to the detailed physics underlying the model. One sees this also in approximations to the numerical studies (Chamandy et al., 2014). However there are some differences. Our time behaviour consists of a power law or exponential growth plus a pattern rotation. There is no predicted intrinsic oscillation as in Brandenburg et al. (1992), although in our model the projected structure can change relative to a fixed line of sight due to magnetic pattern rotation. This oscillation might be difficult to distinguish from higher order modes. It should be noted that (see Fig. 3.7 and Appendix A) that our model can produce RM reversals even in axial symmetry due to pitch angle effects. However the self-similarity also restricts the variation of parity with latitude (it happens only once), which may be a distinguishing feature. It is possible that both types of reversals m = 0 and m = n occur in combination. Our best fits, in fact, require this. 3.7. CONCLUSIONS 77

3.7 Conclusions

Remarkable RM reversals in sign can be seen in the northern halo of RM maps of NGC 4631 as seen in figure 3.1 and Mora-Partiarroyo et al. (2018). We solve the classical dynamo equations under the assumption of scale invariance, and we search for rotating logarithmic spiral modes projected on cones. The three dimensional magnetic fields also have strong poloidal components that appear to loop over the projected spirals near the disk. The model allows for corresponding velocity fields representing accretion onto the disk, outflow from the disk, and rotation-only in a disk pattern frame and we search for solutions for each case. Our models produce magnetic fields and consequently RM sign reversals when viewed edge-on. RM maps are created using a Faraday screen and are scaled to amplitude of the observed maps. Residual images are then made and used to compare how well the different models fit the data. Solutions for rotation-only cases, in general, did not fit the observations of NGC 4631 well. Outflow models provided a reasonable fit to the magnetic field structure, but the best results are found using accretion models for the specified region (boxed in Fig. 3.1).

Acknowledgements

This work has been supported by a Queen Elizabeth II Scholarship in Science and Technology to AW from the Province of Ontario and Queen’s University. JI wishes to thank the Natural Sciences and Engineering Research Council of Canada for a Discovery Grant. 78

Chapter 4

Other Galaxies in the CHANG-ES Sample

Sect. 1.3 outlines the Rotation Measure Synthesis (RM Synthesis) technique. This technique has been carried out on various CHANG-ES galaxies to examine their magnetic fields (see: NGC 4013 (Stein et al., 2019b), NGC 4631 (Mora-Partiarroyo et al., 2018), and NGC 4666 (Stein et al., 2019a)). These papers have been studies of individual galaxies and the parameters used in the RM Synthesis technique are tuned to generate the best possible RM maps for theses galaxies. In addition to these images, CHANG-ES member Philip Schmidt created RM Synthesis images for all galaxies using a standardized set of parameters. CHANG-ES measurements included data from both C-Band images (using C+D array configurations of the EVLA) as well as L-Band images (B+C+D array configurations). RM maps for both of these bands were made. C-band images produced more accurate RM maps and as such are presented in this thesis. To perform RM Synthesis on the CHANG-ES data, image cubes were taken as input data (see Fig. 1.5). The cubes were averaged in C-band over 16 spectral windows corresponding to frequency spacing of 128 MHz and λ2 spacing between 0.7 and 1.7 cm2. RM-Synthesis was performed on the data and cubes showing the 79

Faraday depth were produced covering −8192 rad m−2 to 8192 rad m−2 with channel separation of 64 rad m−2. Of these 35 galaxies, 7 contained little to no polarized emission that could be used to create useful RM Synthesis maps and have not been included. The galaxies ex- cluded for this reason are: NGC 2683, NGC 3003, NGC 3432, NGC 3877, NGC 4096, NGC 4244, and NGC 5297. Furthermore, 9 galaxies were also removed due to having too low a signal to noise ratio in the polarized emission. This resulted in error maps that were much larger than the observed RM values, making the results untrustwor- thy. The galaxies excluded for this reason are: NGC 2820, NGC 3556, NGC 3628, NGC 3735, NGC 4157, NGC 4645, NGC 5792, NGC 5907, and NGC 891. A total of 19 galaxies remain in the sample and are shown in Appendix C. Total intensity in L-band (see Table 1.2) are shown as contours on these images in order to illustrate the galaxy’s location. These contours are set as a multiple of the background noise in the image, called the RMS (σ). The values of σ for each galaxy are shown in Table C.1. The multiples of σ used for the contours are shown in the figure captions. In general, the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384). In certain cases, when the signal to noise ratio (S/N) is high, the beam pattern used in imaging produces higher intensity noise patches around the galaxy that can be seen in the lower contour levels. In these cases a the contour levels start at a higher S/N ratio to avoid these artifacts. Galaxies where this was done were: NGC 660 (3 · σ, 6 · σ contour levels were avoided), NGC 3079 (3 · σ, 6 · σ contour levels were avoided), NGC 4192 (3 · σ contour level was avoided), NGC 4594 (3 · σ contour level was avoided), and NGC 4845 (3 · σ, 6 · σ contour levels were avoided). For some of these galaxies RM results have already been published, including: 80

NGC 4013 (Stein et al., 2019b), NGC 4631 (Mora-Partiarroyo et al., 2018), and NGC 4666 (Stein et al., 2019a). When comparing the maps from these papers to the ones shown in this thesis one notices that the maps look different (see for example the RM Synthesis map of NGC 4631 shown in Fig. 3.1 and Fig. C.14). These differences are due to the parameters used in the RM Synthesis technique. The results shown in this section use a set of standardized parameters for all images while previously published results have been fine tuned for each individual galaxy to generate the best possible maps. When comparing features of these maps it can be seen that reversals in the rotation measures (and therefore in the magnetic fields along the line of sight) are found in the same locations (again see Fig. 3.1 and Fig. C.14). Thus, while the maps use different cutoffs and look slightly different, the results are consistent. It should be noted that some edge effects can be seen in these maps (see Fig. C.13 and Fig. C.14 for examples). These edge effects are not physical and are not true measurements of the RM in that area. These are sidelobe effects resulting from the telescope’s beam pattern.

4.0.1 General Trends

The rotation measure maps shown in Appendix C clearly show that reversals in the magnetic field parallel to the line of sight are common in the sample of galaxies observed. Many of these maps show clear reversals (for example see Figures C.2, C.4, C.8). The reversals seen occur in both the disks (for example see Figs. C.8, C.9, C.15, & C.17) and halos (for example see Figs. C.2, C.4, C.14, & C.18) of these galaxies. Reversals in galactic halos is a new phenomenon first seen in the CHANG-ES survey and first shown in NGC 4631 by Mora-Partiarroyo et al. (2018). The results from the 81

CHANG-ES sample reveal that, for every galaxy in which enough polarization has been detected to produce RM maps, at least one reversal can be seen. While this is concluded from a total of 19 galaxies, it provides a strong indication that magnetic field reversals along the line of sight are common to galactic halos.

4.0.2 Axisymmetric and Bisymmetric Signatures in the Data

Using the produced rotation measure maps, it is possible to look through the data for indicators of axisymmetric or bisymmetric fields (see Fig. 3.2). Henriksen et al. (2018) showed that for an axisymmetric field a maximum of one reversal would be seen when scanning outwards from the minor axis of a galaxy, this can be seen in the leftmost images of Fig. A.1. These reversals tend to show a X shape in the rotation measure map. Additionally, a rotation measure map with no reversals seen when scanning away from the minor axis of a galaxy could also be indicative of an axisymmetric field, as seen on the left hand side of Fig. A.5. Bisymmetric fields are easier to classify, these fields produce magnetic spiral arms that wind around a galaxy as well as a component of the field that crosses over the arms. A common feature of these maps is repeated and systematic reversals in the galactic halo as one scans from left to right, see Sect. A for numerous examples of this. These fields produce a variety of possible rotation measure maps, such as a sign reversal on either side of the minor axis of a galaxy (as seen in the leftmost image of Fig. A.2), and repeated systematic reversals as seen in the middle and rightmost images of Fig. A.2. See Sect. 3 for more detail on bisymmetric fields. Axisymmetric fields are in general harder to determine from rotation measure maps that only show RM for part of a galaxy’s halo, while only one or no reversals 82

may be seen indicating an axisymmetric field, this is not conclusive. In the sample RM from CHANG-ES galaxies shown in App. C Figs. C.3. C.6, & C.19 appear to have patterns that may resemble an X-shaped reversal, possibly indicating an axisymmetric field for these galaxies. Bisymmetric fields are easier to spot with limited data, multiple reversals seen in rotation measure maps are not produced by axisymmetric fields and may be indicative of magnetic spiral arms in a galaxy. Sect. C contains numerous examples of this, see Figures C.4, C.9, C.17 for some examples. Fig. C.8 shows the clearest example, 4 clear field reversals can be seen when viewing right from the minor axis in the northern halo. Another interesting example can been seen in Fig. C.18, a clear change in sign is seen on either side of the minor axis producing a field remarkably similar to the leftmost image of Fig. A.2.

4.0.3 Serendipitous Results

Several interesting results can be seen in the RM images that do not relate to the large scale magnetic field structure of the galaxies observed. These are however noted down and briefly explored in this section. In Fig. C.3, of edge-on galaxy NGC 2992 there is a well resolved map for nearby galaxy NGC 2993 as well, shown in the lower left of the figure. The RM map of this galaxy contains an interesting X-shaped feature with strong reversals. NGC 2993 is fairly well known as the site of several possible supernovae (Brimacombe et al., 2017), however this is not expected to influence the RM maps seen from the galaxy. A brief literature review of NGC 2993 shows that it is a normal (non-barred) face- on spiral galaxy that is known to be interacting with NGC 2992 (Tully and Fisher, 83

1988). NGC 2993 is an irregular dwarf spiral galaxy with a large tidal tail due to its interaction with NGC 2992, observations by Duc et al. (2000) showed that the galaxies are in the early stage of interaction and that the tidal tails are star forming. A literature review does not reveal a strong active galactic nuclei (AGN) or similar features in the galaxy. As this is a face-on galaxy the RM map is expected to be looking at the disk of this galaxy. NGC 3079 is an edge-on galaxy with a detected AGN (Kondratko et al., 2005). This galaxy has a well known super bubble feature due to nuclear activity from the AGN (Li et al., 2019). This bubble feature can be clearly seen in the RM map of NGC 3079 shown in Fig. C.5. No reversals are seen in this feature indicating that the magnetic field points in the same direction along the line of sight. NGC 4438 is well known to have an active AGN that is particularly strong in the radio wavelengths (Li et al., 2016). A large bubble of gas that has been ejected from the galaxy can be seen through radio images of the galaxy (Hummel and Saikia, 1991). This feature can be seen in the RM map seen in Fig. C.12 as indicated by the green arrow. A detectable magnetic field exists in this radio bubble that includes some reversals which are present in the compressed magnetic field around the leading edge of this feature. 84

Chapter 5

Conclusions

Observations of the northern halo of NGC 4631 by Mora-Partiarroyo et al. (2018) reveal remarkable reversals in the sign of the rotation measure (RM). Additional RM maps for edge-on galaxies from the CHANG-ES sample show that regular reversals in the sign of the RM of galactic halos appears to be an common phenomenon in the disks and halos of galaxies, not limited to NGC 4631. Evidence of magnetic fields showing both axisymmetric and bisymmetric magnetic fields are found in these data. This thesis attempts to explain this phenomenon through solving the classical dynamo equations under the assumption of scale invariance and then comparing these solutions to the RM map of NGC 4631. We search for rotating logarithmic spiral modes projected on cones in both axisymmetric and bisymmetric symmetries. The three dimensional magnetic fields found also have strong poloidal components that appear to loop over the projected spirals near the disk. The fitted models found allows for velocity fields that represent accretion onto the disk, outflow from the disk, and rotation-only in a disk pattern frame. The fitted models found produce magnetic fields that show RM sign reversals when viewed edge-on. RM maps are created using a Faraday screen technique and are then scaled to amplitude of the 85

observed maps. Residual images are made by subtracting these model images from the observational RM map of NGC 4631 and are then used to compare how well different models are able to fit the data. Solutions for rotation-only cases, in general, did not fit the observations of NGC 4631 well. Outflow models provided a reasonable fit to the magnetic field structure. Models with outflow may occur due to galactic feedback mechanisms ejecting gas from a galaxy. The best results are found using accretion models for the specified region (boxed in Fig. 3.1). Models with accretion type velocity fields may occur from infalling gas from the intergalactic medium or a fountain type outflow from a galaxy. Future extensions of this work include the possibility of extended the analysis to a larger sample of galaxies. This work fit the dynamo solution to edge-on galaxy NGC 4631, further observational images are shown for a variety of galaxies in Chapter 4 of this work. Model fitting could be extended to these galaxies to be able to show trends in the best fit models. This work can also be extended to galaxies at any arbitrary inclinations, not just edge-on galaxies, in order to examine their magnetic field structure. Dynamo action is thought to be crucial to explain the observed strengths and lifetimes of galactic magnetic fields. Other theories for galactic magnetic fields ex- ist, with the main rival being primordial field theory where one assumes that the observed magnetic patterns arise directly from a pregalactic magnetic fields that are then distorted by the differential galactic rotation. However, dynamo theory provides a universal explanation for the varied field configurations observed in spiral galaxies that primordial field theory cannot (Beck et al., 1996). This work supports this ex- planation, showing that observed reversals in the rotation measure maps of edge-on galaxies can be well explained through classical dynamo theory. BIBLIOGRAPHY 86

Bibliography

Hannes Alfv´en. On the existence of electromagnetic-hydrodynamic waves. Arkiv for matematik, astronomi och fysik, 29:1–7, 1943.

Astropy Collaboration, T. P. Robitaille, E. J. Tollerud, P. Greenfield, M. Droett- boom, E. Bray, T. Aldcroft, M. Davis, A. Ginsburg, A. M. Price-Whelan, W. E. Kerzendorf, A. Conley, N. Crighton, K. Barbary, D. Muna, H. Ferguson, F. Grollier, M. M. Parikh, P. H. Nair, H. M. Unther, C. Deil, J. Woillez, S. Conseil, R. Kramer, J. E. H. Turner, L. Singer, R. Fox, B. A. Weaver, V. Zabalza, Z. I. Edwards, K. Azalee Bostroem, D. J. Burke, A. R. Casey, S. M. Crawford, N. Dencheva, J. Ely, T. Jenness, K. Labrie, P. L. Lim, F. Pierfederici, A. Pontzen, A. Ptak, B. Refsdal, M. Servillat, and O. Streicher. Astropy: A community Python package for astronomy. A&A, 558:A33, October 2013. doi: 10.1051/0004-6361/201322068.

Grigory Isaakovich Barenblatt. Scaling, self-similarity, and intermediate asymptotics: dimensional analysis and intermediate asymptotics, volume 14. Cambridge Univer- sity Press, 1996.

Rainer Beck. Magnetic fields in the nearby spiral galaxy ic 342: A multi-frequency radio polarization study. A&A, 578:A93, 2015. doi: 10.1051/0004-6361/201425572.

URL https://doi.org/10.1051/0004-6361/201425572. BIBLIOGRAPHY 87

Rainer Beck. Magnetic fields in spiral galaxies. A&A Rev., 24(1):4, 2016.

Rainer Beck, Axel Brandenburg, David Moss, Anvar Shukurov, and Dmitry Sokoloff. Galactic magnetism: Recent developments and perspectives. ARA&A, 34(1):155–

206, 1996. doi: 10.1146/annurev.astro.34.1.155. URL https://doi.org/10.1146/ annurev.astro.34.1.155.

Ludwig Biermann. On the origin of magnetic fields on stars and in interstellar space. Z. Naturforsch. A, 5:65–71, 1950.

A. Brandenburg, K. J. Donner, D. Moss, A. Shukurov, D. D. Sokolov, and I. Tuomi- nen. Dynamos in discs and halos of galaxies. A&A, 259:453–461, June 1992.

A. Brandenburg, K. J. Donner, D. Moss, A. Shukurov, D. D. Sokoloff, and I. Tuomi- nen. Vertical Magnetic Fields above the Discs of Spiral Galaxies. A&A, 271:36, April 1993.

R. Braun, G. Heald, and R. Beck. The westerbork sings survey - iii. global magnetic field topology. A&A, 514:A42, 2010. doi: 10.1051/0004-6361/200913375. URL

https://doi.org/10.1051/0004-6361/200913375.

MA Brentjens and AG De Bruyn. Faraday rotation measure synthesis. A&A, 441(3): 1217–1228, 2005.

J. Brimacombe, G. Bock, J. M. Fernandez, S. Kiyota, J. S. Brown, K. Z. Stanek, T. W.-S. Holoien, C. S. Kochanek, J. Shields, T. A. Thompson, B. J. Shappee, J. L. Prieto, D. Bersier, S. Dong, S. Bose, P. Chen, P. Cacella, B. Nicholls, R. S. Post, and G. Stone. ASASSN-17hb and ASASSN-17he: Discovery of Two Probable Supernovae. ATel, 10463, June 2017. BIBLIOGRAPHY 88

BJ Burn. On the depolarization of discrete radio sources by faraday dispersion. MNRAS, 133(1):67–83, 1966.

B Carter and RN Henriksen. A systematic approach to self-similarity in newtonian space-time. J. Math. Phys., 32(10):2580–2597, 1991.

Luke Chamandy. An analytical dynamo solution for large-scale magnetic fields of galaxies. MNRAS, 462(4):4402–4415, 08 2016. ISSN 0035-8711. doi: 10.1093/

mnras/stw1941. URL https://doi.org/10.1093/mnras/stw1941.

Luke Chamandy, Kandaswamy Subramanian, and Alice Quillen. Magnetic arms generated by multiple interfering galactic spiral patterns. MNRAS, 437(1):562–

574, 11 2013. ISSN 0035-8711. doi: 10.1093/mnras/stt1908. URL https: //doi.org/10.1093/mnras/stt1908.

Luke Chamandy, Anvar Shukurov, Kandaswamy Subramanian, , and Katherine Stoker. Non-linear galactic dynamos: a toolbox. MNRAS, 443(3):1867–1880, 07

2014. ISSN 0035-8711. doi: 10.1093/mnras/stu1274. URL https://doi.org/10. 1093/mnras/stu1274.

Luke Chamandy, Anvar Shukurov, and A. Russ Taylor. STATISTICAL TESTS OF GALACTIC DYNAMO THEORY. The Astrophysical Journal, 833(1):43,

dec 2016. doi: 10.3847/1538-4357/833/1/43. URL https://doi.org/10.3847% 2F1538-4357%2F833%2F1%2F43.

Krzysztof T. Chy˙zyand Ronald J. Buta. Discovery of a strong spiral magnetic field crossing the inner pseudoring of NGC 4736. ApJ, 677(1):L17–L20, mar 2008. doi:

10.1086/587958. URL https://doi.org/10.1086%2F587958. BIBLIOGRAPHY 89

F. Combes. A model of tidal interactions within the NGC 4631 group of galaxies. A&A, 65:47–55, April 1978.

James J. Condon and Scott M. Ransom. Essential Radio Astronomy. Princeton Series in Modern Observational Astronomy. Princeton University Press, 2016.

R.-J. Dettmar and M. Soida. Magnetic fields in halos of spiral galaxies. Astronomische Nachrichten, 327:495, June 2006. doi: 10.1002/asna.200610569.

Ralf-JAijrgen˜ Dettmar. Gas in galactic halos. IAUCol, 10(H16):596ˆaA¸S597,˘ 2012. doi: 10.1017/S1743921314012356.

P.-A. Duc, E. Brinks, V. Springel, B. Pichardo, P. Weilbacher, and I. F. Mirabel. For- mation of a Tidal Dwarf Galaxy in the Interacting System Arp 245 (NGC 2992/93). AJ, 120:1238–1264, September 2000. doi: 10.1086/301516.

Peter Erwin. IMFIT: A FAST, FLEXIBLE NEW PROGRAM FOR ASTRONOMI- CAL IMAGE FITTING. ApJ, 799(2):226, jan 2015. doi: 10.1088/0004-637x/799/

2/226. URL https://doi.org/10.1088%2F0004-637x%2F799%2F2%2F226.

K Ferriere. Alpha-tensor and diffusivity tensor due to supernovae and superbubbles in the galactic disk near the sun. A&A, 310:438–455, 1996.

Ferri`ere, Katia and Terral, Philippe. Analytical models of x-shape magnetic fields in galactic halos. A&A, 561:A100, 2014. doi: 10.1051/0004-6361/201322966. URL

https://doi.org/10.1051/0004-6361/201322966.

A. Fletcher, R. Beck, A. Shukurov, E. M. Berkhuijsen, and C. Horellou. Magnetic fields and spiral arms in the galaxy M51. Monthly Notices of the Royal Astronomical BIBLIOGRAPHY 90

Society, 412(4):2396–2416, 04 2011. ISSN 0035-8711. doi: 10.1111/j.1365-2966.

2010.18065.x. URL https://doi.org/10.1111/j.1365-2966.2010.18065.x.

Christopher Mark Harrison. Observational constraints on the influence of active galac- tic nuclei on the evolution of galaxies. PhD thesis, Durham University, 2016.

M. Haverkorn and V. Heesen. Magnetic fields in galactic haloes. Space Sci- ence Reviews, 166(1):133–144, May 2012. ISSN 1572-9672. doi: 10.1007/

s11214-011-9757-0. URL https://doi.org/10.1007/s11214-011-9757-0.

George Heald. The faraday rotation measure synthesis technique. IAUCol, 4(S259): 591–602, 2008.

Heald, G., Braun, R., and Edmonds, R. The westerbork sings survey - ii polarization, faraday rotation, and magnetic fields. A&A, 503(2):409–435, 2009. doi: 10.1051/

0004-6361/200912240. URL https://doi.org/10.1051/0004-6361/200912240.

V. Heesen, M. Krause, R. Beck, B. Adebahr, D.J. Bomans, E. Carretti, M. Dumke, G. Heald, J. Irwin, B.S. Koribalski, D.D. Mulcahy, T. Westmeier, and Dettmar R-J. Radio haloes in nearby galaxies modelled with 1D cosmic ray transport using spinnaker. Monthly Notices of the Royal Astronomical Society, 476(1):158–183, 01

2018. ISSN 0035-8711. doi: 10.1093/mnras/sty105. URL https://doi.org/10. 1093/mnras/sty105.

Heesen, V., Beck, R., Krause, M., and Dettmar, R.-J. Cosmic rays and the magnetic field in the nearby starburst galaxy ngc - i. the distribution and transport of cosmic

rays. A&A, 494(2):563–577, 2009. doi: 10.1051/0004-6361:200810543. URL https: //doi.org/10.1051/0004-6361:200810543. BIBLIOGRAPHY 91

R. N. Henriksen. Magnetic spiral arms in galaxy haloes. Monthly Notices of the Royal Astronomical Society, 469(4):4806–4830, 05 2017a. ISSN 0035-8711. doi:

10.1093/mnras/stx1169. URL https://doi.org/10.1093/mnras/stx1169.

Richard N Henriksen. Scale Invariance: Self-Similarity of the Physical World. John Wiley & Sons, 2015.

RN Henriksen. Steady galactic dynamos and observational consequences i: Halo magnetic fields. arXiv preprint arXiv:1704.06954, 2017b.

R.N. Henriksen. Rotating magnetic spiral arms from dynamo theory. Presented at

The 6th Annual CHANG-ES Collaboration Meeting, Calgary, 2018. URL https: //www.queensu.ca/physics/richard-henriksen.

RN Henriksen, A Woodfinden, and JA Irwin. Exact axially symmetric galactic dy- namos. MNRAS, 476(1):635–645, 2018.

E. Hummel and R.-J. Dettmar. Radio observations and optical photometry of the edge-on spiral galaxy NGC 4631. A&A, 236:33–46, September 1990.

E. Hummel and D. J. Saikia. The anomalous radio features in NGC 4388 and NGC 4438. A&A, 249:43–56, September 1991.

E. Hummel, H. Lesch, R. Wielebinski, and R. Schlickeiser. The radio halo of NGC 4631: Ordered magnetic fields far above the plane. A&A, 197:L29–L31, May 1988.

Judith Irwin, Rainer Beck, R. A. Benjamin, Ralf-Jˆa´LZˇAˇzrgenˆ Dettmar, Jayanne En- glish, George Heald, Richard N. Henriksen, Megan Johnson, Marita Krause, Jiang- Tao Li, Arpad Miskolczi, Silvia Carolina Mora, E. J. Murphy, Tom Oosterloo, BIBLIOGRAPHY 92

Troy A. Porter, Richard J. Rand, D. J. Saikia, Philip Schmidt, A. W. Strong, Rene Walterbos, Q. Daniel Wang, and Theresa Wiegert. Continuum Halos in Nearby Galaxies: An EVLA Survey (CHANG-ES). I. Introduction to the Survey. AJ, 144

(2):43, 2012. URL http://stacks.iop.org/1538-3881/144/i=2/a=43.

Judith Irwin, Marita Krause, Jayanne English, Rainer Beck, Eric Murphy, Theresa Wiegert, George Heald, Rene Walterbos, Richard J. Rand, and Troy Porter. CHANG-ES. III. UGC 10288, An Edge-on Galaxy with a Background Double-lobed

Radio Source. AJ, 146(6):164, 2013. URL http://stacks.iop.org/1538-3881/ 146/i=6/a=164.

Judith Irwin, Ancor Damas-Segovia, Marita Krause, Arpad Miskolczi, Jiangtao Li, Yelena Stein, Jayanne English, Richard Henriksen, Rainer Beck, Theresa Wiegert, and Ralf-JAijrgen˜ Dettmar. Chang-es: XviiiˆaA˘Ttheˇ chang-es survey and selected results. Galaxies, 7(1), 2019. ISSN 2075-4434. doi: 10.3390/galaxies7010042. URL

http://www.mdpi.com/2075-4434/7/1/42.

Judith A Irwin, CD Wilson, T Wiegert, GJ Bendo, BE Warren, QD Wang, FP Israel, S Serjeant, JH Knapen, E Brinks, et al. The jcmt nearby galaxies legacy survey–v. the co (j= 3–2) distribution and molecular outflow in . MNRAS, 410(3): 1423–1440, 2011.

TR Jaffe, JP Leahy, AJ Banday, Samuel M Leach, SR Lowe, and A Wilkinson. Modelling the galactic magnetic field on the plane in two dimensions. MNRAS, 401 (2):1013–1028, 2010.

Ronnie Jansson and Glennys R. Farrar. A NEW MODEL OF THE GALACTIC BIBLIOGRAPHY 93

MAGNETIC FIELD. ApJ, 757(1):14, aug 2012. doi: 10.1088/0004-637x/757/1/14.

URL https://doi.org/10.1088%2F0004-637x%2F757%2F1%2F14.

Ulrich Klein and Andrew Fletcher. Galactic and intergalactic magnetic fields. Springer, 2014.

P. T. Kondratko, L. J. Greenhill, and J. M. Moran. Evidence for a Geometrically Thick Self-Gravitating Accretion Disk in NGC 3079. ApJ, 618:618–634, January 2005. doi: 10.1086/426101.

M. Krause. Magnetic fields in spiral galaxies. Proc. IAU, 10(H16):399–399, 2012. doi: 10.1017/S1743921314011685.

M. Krause. Magnetic fields in spiral galaxies. Highl, 16:399–399, March 2015. doi: 10.1017/S1743921314011685.

Krause, M., Wielebinski, R., and Dumke, M. Radio polarization and sub-millimeter observations of the (ngc 4594) - large-scale magnetic field config- uration and dust emission. A&A, 448(1):133–142, 2006. doi: 10.1051/0004-6361:

20053789. URL https://doi.org/10.1051/0004-6361:20053789.

J.-T. Li, R. Beck, R.-J. Dettmar, G. Heald, J. Irwin, M. Johnson, A. A. Kepley, M. Krause, E. J. Murphy, E. Orlando, R. J. Rand, A. W. Strong, C. J. Vargas, R. Walterbos, Q. D. Wang, and T. Wiegert. CHANG-ES - VI. Probing Super- nova energy deposition in spiral galaxies through multiwavelength relationships. MNRAS, 456:1723–1738, February 2016. doi: 10.1093/mnras/stv2757.

J.-T. Li, E. Hodges-Kluck, Y. Stein, J. N. Bregman, J. A. Irwin, and R.-J. Dettmar. BIBLIOGRAPHY 94

Detection of Nonthermal Hard X-Ray Emission from the Fermi Bubble in an Ex- ternal Galaxy. ApJ, 873:27, March 2019. doi: 10.3847/1538-4357/ab010a.

Dmitry Makarov, Philippe Prugniel, Nataliya Terekhova, H´el`ene Courtois, and Is- abelle Vauglin. HyperLEDA. III. the catalogue of extragalactic distances. A&A, 570:A13, 2014.

Alison Merritt. Analysis of Radio Spectral Indices in the CHANG-ES Galaxy Sample. PhD thesis, Queen’s University, 2019.

Henry K Moffatt. Field generation in electrically conducting fluids. Cambridge Uni- versity Press, Cambridge, London, New York, Melbourne, 2:5–1, 1978.

S.C. Mora-Partiarroyo. Deep radio continuum study of NGC 4631 and its Faraday

tomography. PhD thesis, Rheinischen Friedrich-Wilhelms-Universit¨at Bonn, 2016.

S.C. Mora-Partiarroyo, M. Krause, A. Basu, R. Beck, T. Wiegert, and J. Irwin. CHANG-ES XII: Large-scale magnetic field reversals in the halo of NGC 4631 - a synchrotron and polarization study. submitted to A&A, 2018.

Mora, Silvia Carolina and Krause, Marita. Magnetic field structure and halo in

ngc 4631. A&A, 560:A42, 2013. doi: 10.1051/0004-6361/201321043. URL https: //doi.org/10.1051/0004-6361/201321043.

D. Moss, R. Beck, D. Sokoloff, R. Stepanov, M. Krause, and T. G. Arshakian. The relation between magnetic and material arms in models for spiral galaxies. A&A,

556:A147, 2013. doi: 10.1051/0004-6361/201321296. URL https://doi.org/10. 1051/0004-6361/201321296. BIBLIOGRAPHY 95

Mulcahy, D. D., Beck, R., and Heald, G. H. Resolved magnetic structures in the disk- halo interface of ngc 628. A&A, 600:A6, 2017. doi: 10.1051/0004-6361/201629907.

URL https://doi.org/10.1051/0004-6361/201629907.

N. Oppermann, H. Junklewitz, G. Robbers, M. R. Bell, T. A. Enßlin, A. Bonafede, R. Braun, J. C. Brown, T. E. Clarke, I. J. Feain, B. M. Gaensler, A. Hammond, L. Harvey-Smith, G. Heald, M. Johnston-Hollitt, U. Klein, P. P. Kronberg, S. A. Mao, N. M. McClure-Griffiths, S. P. O’Sullivan, L. Pratley, T. Robishaw, S. Roy, D. H. F. M. Schnitzeler, C. Sotomayor-Beltran, J. Stevens, J. M. Stil, C. Sunstrum, A. Tanna, A. R. Taylor, and C. L. Van Eck. An improved map of the Galactic Faraday sky. A&A, 542:A93, June 2012. doi: 10.1051/0004-6361/201118526.

M.E. Putman, J.E.G. Peek, and M.R. Joung. Gaseous galaxy halos. ARA&A, 50(1):

491–529, 2012. doi: 10.1146/annurev-astro-081811-125612. URL https://doi. org/10.1146/annurev-astro-081811-125612.

R. J. Rand. Atomic hydrogen in the NGC 4631 group of galaxies. A&A, 285:833–856, May 1994.

P. Richter, B. Winkel, B. P. Wakker, N. M. Pingel, A. J. Fox, G. Heald, R. A. M. Wal- terbos, C. Fechner, N. Ben Bekhti, G. Gentile, and L. Zschaechner. Circumgalactic gas at its extreme: Tidal gas streams around the whale galaxy NGC 4631 explored with HST/COS. ApJ, 868(2):112, Nov 2018. doi: 10.3847/1538-4357/aae838. URL

https://doi.org/10.3847%2F1538-4357%2Faae838.

Adler G Santos, Quirino M Sugon Jr, and Daniel J McNamara. Polarization ellipse and stokes parameters in geometric algebra. JOSA A, 29(1):89–98, 2012. BIBLIOGRAPHY 96

Soida, M., Krause, M., Dettmar, R.-J., and Urbanik, M. The large scale magnetic field structure of the spiral galaxy ngc5. A&A, 531:A127, 2011. doi: 10.1051/

0004-6361/200810763. URL https://doi.org/10.1051/0004-6361/200810763.

Y. Stein, R.-J. Dettmar, J. Irwin, R. Beck, M. We˙zgowiec, A. Miskolczi, M. Krause, V. Heesen, T. Wiegert, G. Heald, R. A. M. Walterbos, J.-T. Li, and M. Soida. CHANG-ES. XIII. Transport processes and the magnetic fields of NGC 4666: in- dication of a reversing disk magnetic field. A&A, 623:A33, March 2019a. doi: 10.1051/0004-6361/201834515.

Y. Stein, R.-J. Dettmar, M. We˙zgowiec, J. Irwin, T. Wiegert, R. Beck, M. Krause, J.-T. Li, and S. MacDonald. CHANG-ES XIX: The Galaxy NGC 4013 - Large Scale Vertical Magnetic Field in the Halo. submitted to A&A, 2019b.

A. S. Stephens and T. Velusamy. Interaction of Galactic Wind with Infalling Gas: Plausible Evidence from NGC 4631. International Cosmic Ray Conference, 3:221, 1990.

George Gabriel Stokes. On the change of refrangibility of light. Philosophical trans- actions of the Royal Society of London, (142):463–562, 1852.

Sun, X. H., Reich, W., Waelkens, A., and Enßlin, T. A. Radio observational con- straints on galactic 3d-emission models. A&A, 477(2):573–592, 2008. doi: 10.1051/

0004-6361:20078671. URL https://doi.org/10.1051/0004-6361:20078671.

P Terral and K Ferri`ere. Constraints from faraday rotation on the magnetic field structure in the galactic halo. A&A, 600:A29, 2017. doi: 10.1051/0004-6361/

201629572. URL https://doi.org/10.1051/0004-6361/201629572. BIBLIOGRAPHY 97

R. Tullmann¨ and R.-J. Dettmar. Spectroscopy of diffuse ionized gas in halos of selected edge-on galaxies. A&A, 362:119–132, October 2000.

Tullmann,¨ R., Breitschwerdt, D., Rossa, J., Pietsch, W., and Dettmar, R.-J. The multi-phase gaseous halos of star-forming late-type galaxies - ii. statistical analysis of key parameters. A&A, 457(3):779–785, 2006. doi: 10.1051/0004-6361:20054743.

URL https://doi.org/10.1051/0004-6361:20054743.

R Brent Tully and J Richard Fisher. Catalog of nearby galaxies. Catalog of Nearby Galaxies, by R. Brent Tully and J. Richard Fisher, pp. 224. ISBN 0521352991. Cambridge, UK: Cambridge University Press, April 1988., page 224, 1988.

C. L. Van Eck, J. C. Brown, A. Shukurov, and A. Fletcher. MAGNETIC FIELDS IN a SAMPLE OF NEARBY SPIRAL GALAXIES. ApJ, 799(1):35, jan 2015. doi:

10.1088/0004-637x/799/1/35. URL https://doi.org/10.1088%2F0004-637x% 2F799%2F1%2F35.

Carlos J. Vargas. The Relationship Between Star Formation and Matter in Galaxy Halos. PhD thesis, New Mexico State University, 2017.

Q. D. Wang, S. Immler, R. Walterbos, and D. Breitschwerdt. Chandra Detection of a Hot Gaseous Corona around the Edge-on Galaxy NGC4631. In AAS/High Energy Astrophysics Division #5, volume 32 of BAAS, page 1210, October 2000.

Q. Daniel Wang, Stefan Immler, Rene Walterbos, James T. Lauroesch, and Dieter Breitschwerdt. [ITAL]chandra[/ITAL] detection of a hot gaseous corona around the edge-on galaxy NGC 4631. ApJ, 555(2):L99–L102, jul 2001. doi: 10.1086/323179.

URL https://doi.org/10.1086%2F323179. BIBLIOGRAPHY 98

Theresa Wiegert, Judith Irwin, Arpad Miskolczi, Philip Schmidt, Silvia Carolina Mora, Ancor Damas-Segovia, Yelena Stein, Jayanne English, Richard J. Rand, Isaiah Santistevan, Rene Walterbos, Marita Krause, Rainer Beck, Ralf-Juergen Dettmar, Amanda Kepley, Marek Wezgowiec, Q. Daniel Wang, George Heald, Jiangtao Li, Stephen MacGregor, Megan Johnson, A. W. Strong, Amanda DeS- ouza, and Troy A. Porter. CHANG-ES. IV. Radio Continuum Emission of 35 Edge-on Galaxies Observed with the Karl G. Jansky Very Large Array in D Con-

figuration, Data Release 1. AJ, 150(3):81, 2015. URL http://stacks.iop.org/ 1538-3881/150/i=3/a=81. 99

Appendices 100

Appendix A

General Results and Observational Expectations

In this section we display observational expectations from the magnetic fields pro- duced from the dynamos presented in Chapters 2 & 3. We begin by summarizing the different variables found in these solutions and their physical interpretation (see Table 2.1) and then move on to specific cases. The images presented in this section are RM maps that are obtained by observing the galaxy as though it were face-on or edge-on. The parameter a, found in Eqn. 3.4, is the ’similarity class’ of the model. This parameter represents the dimensions of a globally conserved quantity in the solutions. This is discussed in greater detail in Henriksen, Woodfinden, and Irwin (2018) as well as Sect. 3.3. A summary of different similarity classes and their possible identifications can be found in Table 2.2. The parameter m is used in these spiral solutions to indicate the spiral mode, that is the number of spirals appearing in the solution. In Eqn. 3.10 solutions for the magnetic field potential A¯ are searched for in the complex form A¯ (R, Φ,Z) = A˜ (ζ)eimκ. Fig. A.1 shows edge-on (left column) and face-on (right column) RMs produced for different values of m when other parameters are kept constant. A 101

number of projected magnetic spirals corresponding to the value of m can clearly be seen. The number of sign reversals in the edge-on case increases with increasing m however it should be noted that counting the number of reversals alone cannot determine the value of m seen. The spiral pitch angle discussed later can also cause the projected spiral structure to wrap more tightly or loosely causing more or less reversals to be seen in the edge-on case. Solutions of the dynamo equations for different values of m are independent of one another, however, this does not preclude that multiple solutions may be present. Solutions with the same parameter vector apart from various values of m can be combined together (i.e. solutions for m = 0, m = 1, and m = 2 can be combined to produce a new RM map). Parameters  and q appear in Eqn. 3.8 where they are used to define rotating logarithmic spiral forms. Parameter q represents the pitch angle of the spiral solution. The pitch angle can be found as arctan(1/q). Fig. A.2 shows face-on and edge-on rotation measure maps for the same parameter vector with varying q. As can be seen a higher q decreases the angle of the magnetic spirals. In the edge-on case a lower q (higher pitch angle) causes the spirals to become more tightly wound and produces more reversals across the galaxy halo. The number of reversals seen in the edge-on case depends on both the spiral mode as well as the pitch angle in these solutions. The parameter  is a number that fixes the rate of rotation of the magnetic field in time. By varying  one can rotate the field emulating its rotation with time. This is seen in Fig. A.3 where magnetic structure can be seen rotating as epsilon is increased. Parameters u, v, w are scaled cylindrical velocity components where u is in the r direction, v is in the θ direction, w is in the z direction. These are discussed further 102

Figure A.1: We show edge-on (left column) and face-on (right column) RMs for the parameter vector {m, q, , u, v, w} = {m, 2.5, 0.0, 0.0, 0.0, 2.0}. This is an example of outflow-only from the rotation frame. Parameter m is allowed to vary from top to bottom. In the topmost row m = 0, in the middle row m = 1, and in the bottommost row m = 2. The radius in units of the galactic radii is shown on the face-on figures. The number of magnetic spirals can be seen increase in the face-on case with the number of arms corresponding to the value of m. This arms can be seen as reversals in the edge-on RMs. The x and y axes for the edge-on images correspond to Right Ascension and Declination of the observational map, the units shown is in terms of the pixel number. 103

Figure A.2: We show edge-on (left column) and face-on (right column) RMs for the parameter vector {m, q, , u, v, w} = {1, q, 0.0, 0.0, 0.0, 4.0}. The radius in units of the galactic radii is shown on the face-on figures. This is an ex- ample of outflow-only from the rotation frame. Parameter q = 1.0, 2.5, 4.9 from top to bottom respectively. The number of spirals remains con- stant however becomes more tightly would as q increase. This results in increasing the number of reversals seen in the edge-on case. Scaling depends on an arbitrary multiplicative constant. The x and y axes for the edge-on images correspond to Right Ascension and Declination of the observational map, the units shown is in terms of the pixel number. 104

Figure A.3: We show face-on RMs for the parameter vector {m, q, , u, v, w} = {2, 2.5, , 0.0, 0.0, 4} with  = −0.5, 0.0, 0.5 from top to bottom respec- tively. The radius in units of the galactic radii is shown on the face-on figures and scaling depends on an arbitrary multiplicative constant. This is an example of an outflow model. The spiral pattern can be seen rotat- ing as  is varied. The parameter  can be used to simulate rotation with time of the spiral pattern. A.1. OUTFLOW OR ACCRETION IN THE PATTERN REFERENCE FRAME 105 in the next section.

A.1 Outflow or Accretion in the Pattern Reference Frame

As explained in Sect. 3.4, we will restrict ourselves to solutions where a = 1 and u = v = 0 to study outflow from, and accretion onto, the galactic disk. For these solutions w is allowed to vary and represents the relative amount of inflow/outflow onto the disk. A positive w indicates outflow and a negative w indicates accretion. In Fig. A.4, w is varied for an accretion case where all other parameters are kept constant. As can be seen in this figure the strength of the reversals decreases as the wind speed increases, with a stronger wind producing more well defined reversals. These reversals also have a more vertical structure with less curvature to the shape of the reversals. In the w = −2 case the reversals have a more curved structure, displaying a more kidney bean like structure, while in the w = −5 case the reversals display a much more vertical structure. Solutions for inflow (accretion) and outflow (winds) in general display similar RM maps and can be difficult to distinguish. Fig. A.5 shows different cases of inflow and outflow solutions for edge-on cases. All solutions display similar spiral reversals in m 6= 0 cases seen as reversals across the halo in edge-on galaxies. Outflow versus inflow solutions with the same parameter sets are in general very similar, they however may not display precisely the same patterns. For example in Fig. A.5 the images in the left column are for the same parameter set as the images in the right column with m = 0, 1, 2 from top to bottom respectively except the velocity in the w direction is opposite in sign. While the outflow solution for m = 0 (top left image) shows a field reversal, the inflow solution for m = 0 (top right image) does not. A.1. OUTFLOW OR ACCRETION IN THE PATTERN REFERENCE FRAME 106

Figure A.4: We show edge-on RMs for the parameter vector {m, q, , u, v, w} = {2, 2.5, 0.0, 0.0, 0.0, w} with w = −2, −4, −5 from top to bottom respec- tively. Scaling depends on an arbitrary multiplicative constant. This is an example of an accretion model. All maps show the same structure however the reversals become more spread out in the vertical direction as the wind speed increases. Reversal patterns also become more straight (less curved) with increasing wind speed. The x and y axes correspond to Right Ascension and Declination of the observational map, the units shown is in terms of the pixel number. A.1. OUTFLOW OR ACCRETION IN THE PATTERN REFERENCE FRAME 107

Figure A.5: We show edge-on RMs (with arbitrary scaling) for the parameter vector {m, q, , u, v, w} = {m, 2.5, 0.0, 0.0, 0.0, ±2.0} where w = +2 for the left column and w = −2 for the right column. The parameter is is varied as m = 0, 1, 2 from top to bottom respectively. This figure therefore shows the same solution for outflow in the left column and inflow in the right column. Solutions are in general similar however not necessarily the same. The x and y axes correspond to Right Ascension and Declination of the observational map, the units shown is in terms of the pixel number. A.1. OUTFLOW OR ACCRETION IN THE PATTERN REFERENCE FRAME 108

Figure A.6: We show edge-on RMs for the parameter vector {a, m, q, , u, v, w} = {a, 2, 2.5, −1.0, 0.0, 1.0, 0.0}. This is an example of rotation-only in the pattern frame. Parameter a is allowed to vary from top to bottom. In the topmost row a = 0, in the middle row a = 1, and in the bottommost row a = 2. No clear pattern can be consistently discerned from variations of a. Images with the same parameter vector with a varied are visually similar to one another and do not change drastically. Note the scaling depends on an arbitrary multiplicative constant. The x and y axes correspond to Right Ascension and Declination of the observational map, the units shown is in terms of the pixel number. A.2. ROTATION-ONLY IN THE PATTERN REFERENCE FRAME109

A.2 Rotation-Only in the Pattern Reference Frame

In this subsection we restrict ourselves to solutions where there is rotation-only in the pattern frame by setting u = w = 0, v 6= 0. Unlike the previous subsection this allows a to be arbitrary and a parameter of the solutions. In Fig. A.6, a is varied while all other parameters are kept constant. No discernible pattern can be distinguished between varying a as a parameter and the solutions appear to be independent from one another. Solutions appear to contain strong kidney bean shaped reversals near the disk and reversals are not seen to be linear in height above the disk, rather they curve towards the center. These solutions are distinguishable from the inflow/outflow case by these strong kidney bean shaped reversals as well as solutions being closer to the disk. Reversals in the rotation-only case appear to be bigger in radii than in the inflow/outflow case. Outside of the strong reversal regions little Faraday rotation in usually seen. 110

Appendix B

Conversion From Maple Table to FITS Format

Theoretical models of galactic magnetic field generated from solutions to the dynamo equations have been created using the maths software Maple. In order to compare these models with magnetic fields of edge-on galaxies measured through rotation measure synthesis with the CHANG-ES data set, this maple output, in the form of tables, must be converted to FITS format. This was done utilizing a community- developed core Python package for Astronomy named Astropy (Astropy Collaboration et al., 2013). FITS files contain two main components, a header and a binary table. The header contains information on the image (ex. observer, data, etc.) as well as parameters needed to correctly display the image such as coordinates and pixel size. The binary table contains the information for each pixel, note that there maybe be multiple tables in a single fits file containing different data for the image. To get the Maple table data into this binary format, data were exported from Maple into a .csv file that is then imported into a python script. These data is arranged into the correct orientation and is then converted into the binary table using the Astropy package. 111

In order to compare the Maple output to the collected data, the Maple data needs to be mapped on top of the galaxy. To do this the .FITS file corresponding to to the observational rotation measure map is opened and the header is read. This header is then copied and the header for the new .FITS file is identically matched so that the images will map the same space. As the shape of the data is different for the Maple output and the .FITS file for the observations the number of pixels, pixel size, position of reference pixel, and choice of reference pixel is modified in the new .FITS file header so that the Maple output maps the correct region. The new .FITS file is regridded to match the observations, this is done through a linear interpolation scheme. This regridded file is then saved and can be used to compare the dynamo theory with observations. This process, with the exception of exporting the Maple data into a .csv file, was done using one Python file that can be run from the CASA software package. CASA is a software package developed by the National Radio Astronomy Observatory and is used in the CHANG-ES project as the main data analysis tool. CASA is built on top of python (with a C++ backend) so python scripts can be ran from within the CASA shell. Astropy needs to be manually installed into the CASA shell in order to do be able to perform the CSV to FITS conversion. The code used to perform this conversion is presented in Appendix D. 112

Appendix C

Rotation Measure Synthesis Images 113

Figure C.1: NGC 660: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 114

Figure C.2: NGC 2613: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 115

Figure C.3: NGC 2992: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. Face-on spiral galaxy NGC 2993 can also be seen in the lower left of this image indicated by the green arrow. 116

Figure C.4: NGC 3044: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 117

Figure C.5: NGC 3079: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 118

Figure C.6: NGC 3448: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 119

Figure C.7: NGC 4013: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 120

Figure C.8: NGC 4192: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 121

Figure C.9: NGC 4217: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data. 122

Figure C.10: NGC 4302: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ ·(3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 123

Figure C.11: NGC 4388: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ ·(3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 124

Figure C.12: NGC 4438: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. A large bubble of gas that has been ejected from the galaxy can be seen as indicated by the green arrow in the figure. 125

Figure C.13: NGC 4594: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 126

Figure C.14: NGC 4631: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ ·(3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 127

Figure C.15: NGC 4666: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ ·(3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 128

Figure C.16: NGC 4845: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ · (12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 129

Figure C.17: NGC 5084: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ ·(3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 130

Figure C.18: NGC 5775: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ ·(3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 131

Figure C.19: NGC 10288: top - rotation measure synthesis image. Bottom - rotation measure synthesis error map. Beam size is shown as the green circle in the lower left corner. Total radio intensity is shown as black contours where the contour levels are given by σ ·(3, 6, 12, 24, 48, 96, 192, 384) and σ is the rms noise in the radio intensity data found in Table C.1. 132

Galaxy RMS Value (σ) in L-Band (µJy/beam) NGC 660 28 NGC 2613 28 NGC 2992 24 NGC 3044 29 NGC 3079 28 NGC 3448 23 NGC 4013 20 NGC 4192 21 NGC 4217 25 NGC 4302 28 NGC 4388 80 NGC 4438 100 NGC 4594 24 NGC 4631 26 NGC 4666 20 NGC 4845 40 NGC 5084 24 NGC 5775 22 UGC 10288 20

Table C.1: RMS (σ) values in L-Band for CHANG-ES galaxies presented in Chapter 4. RMS values are a measure of the background noise in an image. Total intensity contours are plotted on the RM synthesis images to show the galaxy’s location, these contours are at a multiple of the RMS (contour levels for each galaxy are shown in the figure captions). 133

Appendix D

Code: Maple Output to Fits File Conversion

The follow is a python program written to convert output from a MAPLE script that produces model rotation measure maps for dynamo solutions, outputted as a .csv file, to a fits image (see Sect. 2.3). The program uses a template fits image to match the image to the same region of the sky and uses the same header as the template file. This script needs to be ran from within the Casa shell. This script has been tested using Casa version 4.7 and Python 2.7. Parameters to change are located at the top of the file. Inputs needed: model rotation measure maps output as .csv files, template image that will be used as the observational comparison, galaxy diameter (used to scale model image to the correct size). Output: model rotation measure map that has been regridded to make the obser- vational template image in .fits format. 134

1 ”””Python program to convert maple output, asa.csv file, toa fits image. Usesa template fits image to make maple output match and uses the same header as the template file. Needs to be ran from within the casa shell(using execfile(”MapleToFits.py”)), program was tested using casa version 4.7 and python 2.7. Parameters to change are located at top of file.”””

2 #Created by Alex Woodfinden(a. [email protected]) Aug 2017

3 ##################### PARAMETERS TO CHANGE #######################

4 f i t s F i l e=”NGC4631 MoraP RMsynth RM 4.fits”#fits file we are making out data look like, we will copy the header and match dimensions

5 o u t f i l e=”spiralexactvne0allaN.fits”#end with.fits

6 Overwrite=True#if we should overwrite outfile if it exists

7 gD=15.5/60.0#galaxy diameter in degrees(deg= 60 ∗ arcmin)

8 QuadOne=True#if we have data for quadrant1

9 mapFileQ1=”spiralexactne0allaN.csv”#this is the maple output for quadrant1 to be converted to fits, must be in csv format

10 rotQ1x=False#whether to flip the input data along thex axis

11 rotQ1y=False#whether to flip the input data along they axis

12 QuadTwo=True#if we have data for quadrant2

13 mapFileQ2=”spiralexactne0allaN.csv”#this is the maple output for quadrant2 to be converted to fits, must be in csv format

14 rotQ2x=True#whether to flip the input data along thex axis

15 rotQ2y=False#whether to flip the input data along they axis

16 QuadThree=True#if we have data for quadrant3

17 mapFileQ3=”spiralexactne0allaN.csv”#this is the maple output for quadrant3 to be converted to fits, must be in csv format

18 rotQ3x=True#whether to flip the input data along thex axis

19 rotQ3y=True#whether to flip the input data along they axis

20 QuadFour=True#if we have data for quadrant4 135

21 mapFileQ4=”spiralexactne0allaN.csv”#this is the maple output for quadrant4 to be converted to fits, must be in csv format

22 rotQ4x=False#whether to flip the input data along thex axis

23 rotQ4y=True#whether to flip the input data along they axis

24

25 ##################################################################

26

27 from astropy.io import fits

28 import numpy as np

29 import csv,sys

30 from astropy.wcs import WCS

31 from astropy.utils.data import get p k g d a t a f i l e n a m e

32

33

34

35 #import and unload data

36 i f QuadOne == True:

37 mapleDataQ1=[]

38 with open(mapFileQ1) as csvfile:

39 reader = csv.reader(csvfile)

40 mapleDataQ1 = list(reader)

41 i f QuadTwo == True :

42 mapleDataQ2=[]

43 with open(mapFileQ2) as csvfile:

44 reader = csv.reader(csvfile)

45 mapleDataQ2 = list(reader)

46 i f QuadThree == True:

47 mapleDataQ3=[]

48 with open(mapFileQ3) as csvfile: 136

49 reader = csv.reader(csvfile)

50 mapleDataQ3 = list(reader)

51 i f QuadFour == True:

52 mapleDataQ4=[]

53 with open(mapFileQ4) as csvfile:

54 reader = csv.reader(csvfile)

55 mapleDataQ4 = list(reader)

56

57

58

59 #check about of data points in each quadrants, assumes quadrants have the same size

60 i f QuadOne == True:

61 numYQuad = len (mapleDataQ1)

62 numXQuad = len(mapleDataQ1[0])

63 e l i f QuadTwo == True :

64 numYQuad = len (mapleDataQ2)

65 numXQuad = len(mapleDataQ2[0])

66 e l i f QuadThree == True:

67 numYQuad = len (mapleDataQ3)

68 numXQuad = len(mapleDataQ3[0])

69 e l i f QuadFour == True:

70 numYQuad = len (mapleDataQ4)

71 numXQuad = len(mapleDataQ4[0])

72 e l s e:

73 p r i n t”At least one quadrant needs to be enabled”

74 sys.exit(0)

75

76 137

77 ##rearranges data for each quadrant into shape that can be converted to .fits

78 arrangeDataQ1=[]

79 #axis dimensions are thex andy lengths

80 #axis2(y axis) of image

81 i f QuadOne == True:

82 f o ri in range(len(mapleDataQ1)) :

83 arrangeDataQ12=[]

84 #axis1(x axis) on image

85 f o rj in range(len(mapleDataQ1[0]) ):

86 #this is the value of the field when viewed float if exists, blank if not

87 try:

88 i f str(mapleDataQ1[j ][ i ]) !=”Float(undefined)”:

89 arrangeDataQ12 .append(float(mapleDataQ1[j ][ i ]))

90 e l s e:

91 arrangeDataQ12 .append(float( ' nan ' ))

92 except:

93 arrangeDataQ12 .append(float( ' nan ' ))

94 i f rotQ1x== True:

95 arrangeDataQ1.append(arrangeDataQ12 [:: 1])#reverses the list( f l i p s alongx axis for quadrant)

96 e l s e:

97 arrangeDataQ1 .append(arrangeDataQ12)

98 e l s e:

99 f o ri in range (numYQuad) :

100 arrangeDataQ12=[]

101 f o rj in range (numXQuad) :

102 arrangeDataQ12 .append(float( ' nan ' )) 138

103 arrangeDataQ1 .append(arrangeDataQ12)

104 i f rotQ1y==True:

105 arrangeDataQ1=arrangeDataQ1 [:: 1]#flips alongy axis

106 #repeat for other quadrants

107 arrangeDataQ2=[]

108 i f QuadTwo == True :

109 f o ri in range(len(mapleDataQ2)) :

110 arrangeDataQ22=[]

111 #axis1(x axis) on image

112 f o rj in range(len(mapleDataQ2[0]) ):

113 #this is the value of the field when viewed float if exists, blank if not

114 try:

115 i f str(mapleDataQ2[j ][ i ]) !=”Float(undefined)”:

116 arrangeDataQ22 .append(float(mapleDataQ2[j ][ i ]))

117 e l s e:

118 arrangeDataQ22 .append(float( ' nan ' ))

119 except:

120 arrangeDataQ22 .append(float( ' nan ' ))

121 i f rotQ2x== True:

122 arrangeDataQ2.append(arrangeDataQ22 [:: 1])#reverses the list( f l i p s alongx axis for quadrant)

123 e l s e:

124 arrangeDataQ2 .append(arrangeDataQ22)

125 e l s e:

126 f o ri in range (numYQuad) :

127 arrangeDataQ22=[]

128 f o rj in range (numXQuad) :

129 arrangeDataQ22 .append(float( ' nan ' )) 139

130 arrangeDataQ2 .append(arrangeDataQ22)

131 i f rotQ2y==True:

132 arrangeDataQ2=arrangeDataQ2 [:: 1]#flips alongy axis

133 arrangeDataQ3=[]

134 i f QuadThree == True:

135 f o ri in range(len(mapleDataQ3)) :

136 arrangeDataQ32=[]

137 #axis1(x axis) on image

138 f o rj in range(len(mapleDataQ3[0]) ):

139 #this is the value of the field when viewed float if exists, blank if not

140 try:

141 i f str(mapleDataQ3[j ][ i ]) !=”Float(undefined)”:

142 arrangeDataQ32 .append(float(mapleDataQ3[j ][ i ]))

143 e l s e:

144 arrangeDataQ32 .append(float( ' nan ' ))

145 except:

146 arrangeDataQ32 .append(float( ' nan ' ))

147 i f rotQ3x== True:

148 arrangeDataQ3.append(arrangeDataQ32 [:: 1])#reverses the list( f l i p s alongx axis for quadrant)

149 e l s e:

150 arrangeDataQ3 .append(arrangeDataQ32)

151 e l s e:

152 f o ri in range (numYQuad) :

153 arrangeDataQ32=[]

154 f o rj in range (numXQuad) :

155 arrangeDataQ32 .append(float( ' nan ' ))

156 arrangeDataQ3 .append(arrangeDataQ32) 140

157 i f rotQ3y==True:

158 arrangeDataQ3=arrangeDataQ3 [:: 1]#flips alongy axis

159 arrangeDataQ4=[]

160

161 i f QuadFour == True:

162 f o ri in range(len(mapleDataQ4)) :

163 arrangeDataQ42=[]

164 #axis1(x axis) on image

165 f o rj in range(len(mapleDataQ4[0]) ):

166 #this is the value of the field when viewed float if exists, blank if not

167 try:

168 i f str(mapleDataQ4[j ][ i ]) !=”Float(undefined)”:

169 arrangeDataQ42 .append(float(mapleDataQ4[j ][ i ]))

170 e l s e:

171 arrangeDataQ42 .append(float( ' nan ' ))

172 except:

173 arrangeDataQ42 .append(float( ' nan ' ))

174 i f rotQ4x== True:

175 arrangeDataQ4.append(arrangeDataQ42 [:: 1])#reverses the list( f l i p s alongx axis for quadrant)

176 e l s e:

177 arrangeDataQ4 .append(arrangeDataQ42)

178 e l s e:

179 f o ri in range (numYQuad) :

180 arrangeDataQ42=[]

181 f o rj in range (numXQuad) :

182 arrangeDataQ42 .append(float( ' nan ' ))

183 arrangeDataQ4 .append(arrangeDataQ42) 141

184 i f rotQ4y==True:

185 arrangeDataQ4=arrangeDataQ4 [:: 1]#flips alongy axis

186

187

188 allData =[]

189 #add the quadrants together

190 f o ri in range (numYQuad) :

191 t = arrangeDataQ3[ i]+arrangeDataQ4[ i ]

192 allData.append(t [:: 1])

193 f o ri in range (numYQuad) :

194 t = arrangeDataQ2[ i]+arrangeDataQ1[ i ]

195 allData.append(t [:: 1])

196

197 #make data into hdu type

198 makeFitsDataQ1 = np.array(allData)

199 hdunew = fits .PrimaryHDU(makeFitsDataQ1)

200

201 #copys old fits file header to new fits file header, we will change c e r t a i n parameters later

202 hdu1t = fits.open(fitsFile)

203 hduold = hdu1t[0]

204 f o ri in hduold.header:

205 #errors in fits header creation may have made empty rows that we need to exclude

206 #history and comments also do not copy over well

207 #if you get an error about the header it may bea bad field you need to exlude like here.

208 i f str(i) !=”” and str(i) !=”” and str(i) !=” \n” and str(i) != ' ' and str(i) != 'COMMENT' and str(i) != 'HISTORY ' : 142

209 #if string cast toa string to avoid errors

210 i f type(hduold.header[i ]) == str:

211 hdunew. header .set(i,str(hduold.header[i ]))

212 e l s e:

213 hdunew. header .set(i ,hduold.header[i ])

214

215 ####change coordinate parameters

216 ndel1 = gD/(2∗numXQuad)#set pixel size

217 ndel2 = gD/(4∗numYQuad)#output given is to galaxy radius in one d i r e c t i o n and half radius iny direction, needs to be checked for each input

218 hdunew. header .set( 'CDELT1 ' , ndel1 )

219 hdunew. header .set( 'CDELT2 ' , ndel2 )

220

221

222 ####s e t reference pixel to be center of image as per convention

223 hdunew. header .set(”CRPIX1”,float (numXQuad) +0.5)#uses center of pixel

224 hdunew. header .set(”CRPIX2”,float (numYQuad) +0.5)

225

226

227 #####needs to bea unique outfile name or overwrite set to true

228 hdunew. writeto(outfile , clobber=Overwrite)

229

230 importfits(fitsimage=outfile ,imagename=outfile [: 5]+”.im”,overwrite= Overwrite )

231 importfits(fitsimage=fitsFile ,imagename=fitsFile [: 5]+”.im”,overwrite= True )#this overwrite could be set to false to be less wasteful but then you get an error if this step has been done before(that can be ignored) 143

232 imregrid(imagename=outfile [: 5]+”.im”,template=fitsFile [: 5]+”.im”, output=outfile [: 5]+”.regrid.im”,overwrite=Overwrite)

233 exportfits(imagename=outfile [: 5]+”.regrid.im”,fitsimage=outfile [: 5]+”. r e g r i d.fits”,overwrite=Overwrite)

234

235 p r i n t(”Raw fits output created at”+ outfile +” and regridded image to match template file located at”+ outfile[: 5] +”.regrid.fits”) 144

Appendix E

Code: Automation of Analysis to Search a Large

Parameter Space

The follow is a python program written to automate data analysis and comparisons of models rotation measure maps with observational rotation measure maps (see Sect. 2.3). Model rotation measure maps are prodiced from MAPLE scripts and output as .csv files. Information needed on the model rotation measure maps are stored in the neccessary input file rmModels.csv, each line of this file corresponds to a different rotation measure model image. Information needed on the observational rotation measure maps are stored in neccessary input file rmMaps.csv, each line of this file corresponds to a different observational rotation measure map. This script needs to be ran from within the Casa shell. This script has been tested using Casa version 4.7 and Python 2.7. Parameters to change are located in rmMaps.csv and rmModels.csv. Input file rmModels.csv must have the information needed in the following or- der separated by commas (as this is a .csv file): model rotation measure map file name for quadrant 1 (as a string), dynamo description (as a string), parameter vec- tor (as a string), whether or not data for the second quadrant exist (as a Boolean), 145

model rotation measure map file name for quadrant 2 (as a string), whether or not the model image for quadrant 2 needs to be flipped along the x-axis (as a Boolean, this is generally true), whether or not the model image for quadrant 2 needs to be flipped along the y-axis (as a Boolean, this is generally false), whether or not data for the third quadrant exist (as a Boolean), model rotation measure map file name for quadrant 3 (as a string), whether or not the model image for quadrant 3 needs to be flipped along the x-axis (as a Boolean, this is generally true), whether or not the model image for quadrant 3 needs to be flipped along the y-axis (as a Boolean, this is generally true), whether or not data for the forth quadrant exist (as a Boolean), model rotation measure map file name for quadrant 4 (as a string), whether or not the model image for quadrant 4 needs to be flipped along the x-axis (as a Boolean, this is generally false), whether or not the model image for quadrant 4 needs to be flipped along the y-axis (as a Boolean, this is generally true). For each additional model rotation measure image the same information needs to be included on a separate line. An example of a valid line for this file is: ”outflowModelQ1-m=0q=1.0w=5e=0.0.csv”, ”Outflow Model”, ”m,q,epsilon,w,T,C1,C2 = 0,1.0,0.,5,1,1,0”, True, ”outflowModelQ2- m=0q=1.0w=5e=0.0.csv”, True, False, True, ”outflowModelQ3-m=0q=1.0w=5e=0.0.csv”, True, True, False,”outflowModelQ4-m=0q=1.0w=5e=0.0.csv”, False, False. Input file rmModels.csv must have the information needed in the following order separated by commas: observational rotation measure map file name (as a string), galaxy diameter in degrees (as a float), x-coordinate of the lower left corner of box used in data analysis (see red box on Fig. 3.1) in pixel coordinates (as an integer), y-coordinate of the lower left corner of box used in data analysis in pixel coordinates (as an integer), x-coordinate of the upper right corner of box used in data analysis 146

in pixel coordinates (as an integer), y-coordinate of the upper right corner of box used in data analysis in pixel coordinates (as an integer), x-coordinate of the cen- ter of the galaxy in pixel coordinates (as an integer), y-coordinate of the center of the galaxy in pixel coordinates (as an integer), lower bound of the x-range to plot in pixel coordinates (as an integer), upper bound of the x-range to plot in pixel co- ordinates (as an integer), lower bound of the y-range to plot in pixel coordinates (as an integer), upper bound of the y-range to plot in pixel coordinates (as an inte- ger). For each additional observational rotation measure image the same information needs to be included on a separate line. An example of a valid line for this file is: ”NGC4631 MoraP RMsynth RM 4.rotated.fits”, 6.5/60, 147, 174, 225, 188, 197, 165, 100, 294, 115, 215. Inputs needed: rmModels.csv, rmMaps.csv, python script to convert Maple output to .fits file (see App. D). Output: will produce a folder for each observational image, inside is a folder for each model rotation measure map containing regridded model RM image, the observational image, and a residual image from subtracting the model image from the observational image; a folder called medians.txt is created that will contain a line for each model and observational map compared with the median of the residual image, median absolute deviation of the residual image, standard deviation of the residual image, and AIC of the fit for the box used in the data analysis (see red box in Fig. 3.1).

1 ### This program will takea list of rotation measure maps anda list of r o t a t i o n measures(as.csv files) and applya fitting routine to these

2 ### Written by Alex Woodfinden, April 2018 147

3 ###############################################

4

5 #need files rmMaps.csv, rmModels.csv, must be ran from within casa, used casa version 4.7 for this

6

7

8 #imports

9 import os,sys,csv,math

10 import matplotlib.pyplot as plt

11 from astropy.io import fits

12 import numpy as np

13 import datetime

14 import shutil

15 import matplotlib.patches as patches

16 p l t . i o f f ( )#turns interactive plotting off(plot only displayed if plt. show() is called)

17

18 #Global variables

19 m2f=”MapleToFits.py”#maple to fits python file make sure it isa modified version that accepts the parameters at the top as an e x t e r n a l file

20

21 #print startTime

22 startTime=datetime . datetime .now()

23 p r i n t startTime

24

25 #check needed files exist

26 i f os.path.exists(m2f) != True:

27 p r i n t”Maple to fits file does not exist” 148

28 sys.exit(0)

29 i f os.path.exists(”rmMaps.csv”) != True:

30 p r i n t”Rotation measure maps(observed) list with bbox values file does not exist”

31 sys.exit(0)

32 i f os.path.exists(”rmModelsCombined.csv”) != True:

33 p r i n t”Rotation measure model file does not exist”

34 sys.exit(0)

35 i f os.path.exists(”mediansCombined.txt”) == True:

36 p r i n t”Medians file already exists, delete this to run the fitting r o u t i n e s.”

37 sys.exit(0)

38 e l s e:

39 os . system (”touch mediansCombined.txt”)

40

41 #import rm Maps and Models

42 with open(”rmMaps.csv”, ' r ' ) as fp :

43 reader = csv.reader(fp, delimiter=' , ' )

44 maps = [ row for row in reader]

45

46 with open(”rmModelsCombined.csv”, ' r ' ) as fp :

47 reader = csv.reader(fp, delimiter=' , ' )

48 models = [row for row in reader]

49

50

51 os . mkdir (”ImagesCombined”)#if you need to restart comment out this line

52 #create directory system to work in

53 f o r ii in maps: 149

54 os . mkdir (”./ImagesCombined/”+ str(ii[0][: 5]))#if you need to restart comment out this line

55 os . mkdir (”./Combined”+ str(ii[0])[: 5])#if you need to restart comment out this line

56 f o r jj in models:

57 i f os.path.exists(”./”+ str(jj[0])[: 4]):

58 shutil .rmtree(”./”+ str(jj[0])[: 4])

59 os . mkdir (”./”+ str(jj[0])[: 4])

60 os . c hdir (”./”+ str(jj[0])[: 4])

61

62 ###this is where the working code for the subdirectories should be done

63

64 #copy all needed files

65 os . system (”cp../../” + m2f+”./”)

66 os . system (”cp../../”+ str(ii[0]) +”./”)

67 i f str(jj [3])==”True”:

68 os . system (”cp../../ csvfiles/”+ str(jj[4]) +”./”)

69 i f str(jj [7])==”True”:

70 os . system (”cp../../ csvfiles/”+ str(jj[8]) +”./”)

71 i f str(jj [11])==”True”:

72 os . system (”cp../../ csvfiles/”+ str(jj[12]) +”./”)

73 os . system (”cp../../ csvfiles/”+ str(jj[0]) +”./”)

74

75

76

77

78

79 150

80

81 #run mapletofits conversion passing needed parameters to python file

82 m2fd =[]

83 m2fd.append( ii [0])#fits map file

84 m2fd.append(jj [0][: 4]+”.fits”)#outfile name

85 m2fd.append(”True”)#if overwrite is enabled

86 m2fd.append( ii [1])#galaxy diameter in degrees, an expression is okay i.e 15.5arcmin/60 to get degrees

87 m2fd.append(”True”)#if we have data for quadrant1

88 m2fd.append( jj [0])#this is the maple output for quadrant1 to be converted to fits, must be in csv format

89 m2fd.append(”False”)#whether to flip the input data along thex axis

90 m2fd.append(”False”)#whether to flip the input data along they axis

91 m2fd.append(”True”)#if we have data for quadrant2

92 i f str(jj [3])==”True”:

93 m2fd.append( jj [4])#this is the maple output for quadrant2 to be converted to fits, must be in csv format

94 m2fd.append( jj [5])#whether to flip the input data along thex axis

95 m2fd.append( jj [6])#whether to flip the input data along they axis

96 e l s e:

97 m2fd.append( jj [0])#this is the maple output for quadrant2 to be converted to fits, must be in csv format

98 m2fd.append(”True”)#whether to flip the input data along thex a x i s

99 m2fd.append(”False”)#whether to flip the input data along they a x i s

100 m2fd.append(”True”)#if we have data for quadrant3

101 i f str(jj [7])==”True”: 151

102 m2fd.append( jj [8])#this is the maple output for quadrant2 to be converted to fits, must be in csv format

103 m2fd.append( jj [9])#whether to flip the input data along thex axis

104 m2fd.append( jj [10])#whether to flip the input data along they a x i s

105 e l s e:

106 m2fd.append( jj [0])#this is the maple output for quadrant3 to be converted to fits, must be in csv format

107 m2fd.append(”True”)#whether to flip the input data along thex a x i s

108 m2fd.append(”True”)#whether to flip the input data along they a x i s

109 m2fd.append(”True”)#if we have data for quadrant4

110 i f str(jj [11])==”True”:

111 m2fd.append( jj [12])#this is the maple output for quadrant2 to be converted to fits, must be in csv format

112 m2fd.append( jj [13])#whether to flip the input data along thex a x i s

113 m2fd.append( jj [14])#whether to flip the input data along they a x i s

114 e l s e:

115 m2fd.append( jj [0])#this is the maple output for quadrant4 to be converted to fits, must be in csv format

116 m2fd.append(”False”)#whether to flip the input data along thex a x i s

117 m2fd.append(”True”)#whether to flip the input data along they a x i s

118 m2ff = open( ' MapleToFitsImports.csv ' , 'w ' )

119 with m2ff : 152

120 writer = csv.writer(m2ff)

121 f o r kk in m2fd:

122 writer.writerow([kk])

123 e x e c f i l e (m2f)

124

125

126 #set scale for all images based of max/min from desired area of map, model images will be shown on same scale

127 imscale=imstat(imagename=str(ii [0]) ,box=str(ii [2])+”,”+str(ii [3])+”, ”+str(ii [4])+”,”+str(ii[5]))

128 immax=imscale [ 'max ' ] [ 0 ]

129 immin=imscale [ ' min ' ] [ 0 ]

130 scalemax=math. fabs(max(immax,immin))

131

132

133 #perform fitting routine

134 ### different scaling methods here. Only one method should be ran, o t h e r s should be commented out.

135 immath(imagename=[str(ii[0][: 5]) +”.im”,str(jj[0][: 4]) +”.regrid. im”] ,expr=”abs(IM0/IM1)”,outfile=”divided.im”)

136

137

138 ###scaling method one, dividing images and taking mean, this method was found to perform best

139 scaled=imstat(imagename=”divided.im”,box=str(ii [2])+”,”+str(ii [3])+”

,”+str(ii [4])+”,”+str(ii[5]))[ ' median ' ] [ 0 ]

140

141

142 ###scaling method two, setting medians to be the same 153

143 # scaled1=imstat(imagename=str(ii[0][: 5])+”.im”,box=str(ii[2]) +”,”+ s t r(ii[3]) +”,”+str(ii[4]) +”,”+str(ii[5]))

144 # scaled2=imstat(imagename=str(jj[0][: 4])+”.regrid.im”,box=str(ii [ 2 ] ) +”,”+str(ii[3]) +”,”+str(ii[4]) +”,”+str(ii[5]))

145 # scaled=float(scaled1[ ' median ' ] [ 0 ] )/float(scaled2[ ' median ' ] [ 0 ] )

146

147

148 ###scaling method three, setting maximum to be the same

149 # scaled1=imstat(imagename=str(ii[0][: 5])+”.im”,box=str(ii[2]) +”,”+ s t r(ii[3]) +”,”+str(ii[4]) +”,”+str(ii[5]))

150 # scaled2=imstat(imagename=str(jj[0][: 4])+”.regrid.im”,box=str(ii [ 2 ] ) +”,”+str(ii[3]) +”,”+str(ii[4]) +”,”+str(ii[5]))

151 # scaled=float(scaled1[ ' max ' ] [ 0 ] )/float(scaled2[ ' max ' ] [ 0 ] )

152 ###

153

154 #create residual maps and perform data analysis

155 immath(imagename=[str(jj[0][: 4]) +”.regrid.im”] ,expr=”IM0 ∗ ”+str( scaled),outfile=' s c a l e d.im ' )

156 immath(imagename=[str(ii[0][: 5]) +”.im”,”scaled.im”], expr=”IM1 IM0”,outfile=”residual.im”)

157 immath(imagename=[”residual.im”], expr=”abs(IM0)”,outfile=” absresidual.im”)

158

159 #AIC calculation

160 i f os.path.exists(”likelihood.im”) == True:

161 shutil .rmtree(”./likelihood.im”)

162 immath(imagename=[”residual.im”,”N4631 Cband20RMErr 4sig.rotated.im”

] , expr=”(IM0 ∗IM0)/(IM1 ∗IM1)”,outfile=”likelihood.im”) 154

163 lfbox=imstat(imagename=”likelihood.im”,box=str(ii [2])+”,”+str(ii[3]) +”,”+str(ii [4])+”,”+str(ii[5]))

164 l f=l f b o x [ 'sum ' ] [ 0 ]

165 npts = lfbox[ ' npts ' ] [ 0 ]

166 AIC = l f + 2 . ∗ 4 . + 2 . ∗ ( 4 . ) ∗ (4. 1.)/(npts 4. 1.)

167

168

169 #data analysis

170 med=imstat (imagename=”residual.im”,box=str(ii [2])+”,”+str(ii [3])+”,” +str(ii [4])+”,”+str(ii[5]))

171 meda=med [ ' median ' ] [ 0 ]

172 medb=med [ ' medabsdevmed ' ] [ 0 ]

173 medc=med [ ' sigma ' ] [ 0 ]

174 m e d f i l e = open( ' mediansCombined.txt ' , 'w ' )

175 with medfile:

176 writer = csv.writer(medfile)

177 writer .writerow([meda])

178 writer .writerow([medc])

179 writer .writerow([AIC])

180 med2 file = open( ' ../../ mediansCombined.txt ' , ' a ' )

181 with med2file:

182 writer = csv.writer(med2file)

183 writer.writerow([ ii [0], jj [0]])

184 writer.writerow([”median”,meda])

185 writer.writerow([”std dev”,medc])

186 writer.writerow([”AIC” ,AIC ] )

187

188

189 #plot residual image and label median and std dev 155

190 exportfits (imagename=' r e s i d u a l.im/ ' ,fitsimage=' r e s i d u a l.fits ' )

191 hdu = f i t s .open(”residual.fits”)[0]

192 image data = hdu.data[0][0]

193 ax = plt.subplot(111)#,projection=proj)

194 im=ax.imshow(image data , cmap=' coolwarm ' ,vmin= 100.,vmax=100.,origin= ”lower”)#vmin and vmax set to be stand values here, can add vmin and vmax for individual maps later if needed

195 plt.colorbar(im)

196 rect = patches.Rectangle((int(ii[2]),int(ii[3])),int(ii[4]) int(ii

[ 2 ] ) ,int(ii[5]) int(ii [3]) , fill=False ,linewidth=1,edgecolor= ' r ' )

197 ax . add patch(rect)

198 ax.text(240, 230, ' median= %.2f \n STD= %.2f \n AIC=%d '% (meda , medc,AIC) , style=' i t a l i c ' , bbox={ ' f a c e c o l o r ' : ' wheat ' , ' alpha ' : 0 . 2 , ' pad ' : 1 0 } )

199 ax . p l o t ( [int(ii[6]), int(ii[6])], [int(ii[7]) 35,int(ii [7])+35], ' k ' , lw=1)

200 ax . p l o t ( [int(ii[6]) 50,int(ii[6])+50], [int(ii[7]),int(ii[7])], ' k ' , lw=1)

201 p l t . xlim (int(ii[8]),int(ii[9]))

202 p l t . ylim (int(ii[10]),int(ii[11]))

203 imoutname=str(ii[0])[: 5] +””+str(jj[0])[: 4] +” residual.png”

204 plt . savefig(imoutname,bbox inches=”tight”)

205 os . system (”cpf” + imoutname +”../../ ImagesCombined/”+ str(ii [ 0 ] [ : 5 ] ) )

206 plt.close()

207

208

209

210 #plot scaled image and label median and std dev 156

211 exportfits (imagename=' s c a l e d.im/ ' ,fitsimage=' s c a l e d.fits ' )

212 hdu = f i t s .open(”scaled.fits”)[0]

213 image data = hdu.data[0][0]

214 ax = plt.subplot(111)#,projection=proj)

215 med=imstat (imagename=”scaled.im”,box=str(ii [2])+”,”+str(ii [3])+”,”+ s t r(ii [4])+”,”+str(ii[5]))

216 meda=med [ ' median ' ] [ 0 ]

217 medb=med [ ' medabsdevmed ' ] [ 0 ]

218 medc=med [ ' sigma ' ] [ 0 ]

219 im=ax.imshow(image data ,vmin= 1.1 ∗ scalemax ,vmax=1.1∗ scalemax , origin= ”lower” ,cmap= ' coolwarm ' )#vmin and vmax set to be stand values here, can add vmin and vmax for individual maps later if needed

220 plt.colorbar(im)

221 rect = patches.Rectangle((int(ii[2]),int(ii[3])),int(ii[4]) int(ii

[ 2 ] ) ,int(ii[5]) int(ii [3]) , fill=False ,linewidth=1,edgecolor= ' r ' )

222 ax . add patch(rect)

223 ax.text(240, 230, ' median= %.2f \n MAD= %.2f \n STD= %.2f '% (meda , medb,medc) , style=' i t a l i c ' , bbox={ ' f a c e c o l o r ' : ' wheat ' , ' alpha ' : 0 . 2 , ' pad ' : 1 0 } )

224 ax . p l o t ( [int(ii[6]), int(ii[6])], [int(ii[7]) 35,int(ii [7])+35], ' k ' , lw=1)

225 ax . p l o t ( [int(ii[6]) 50,int(ii[6])+50], [int(ii[7]),int(ii[7])], ' k ' , lw=1)

226 p l t . xlim (int(ii[8]),int(ii[9]))

227 p l t . ylim (int(ii[10]),int(ii[11]))

228 imoutname=str(ii[0])[: 5] +””+str(jj[0])[: 4] +” scaled.png”

229 plt . savefig(imoutname,bbox inches=”tight”)

230 os . system (”cpf” + imoutname +”../../ ImagesCombined/”+ str(ii [ 0 ] [ : 5 ] ) ) 157

231 plt.close()

232

233

234 ### no code below here for the fitting function

235 os . c hdir (”../”)

236 os . c hdir (”../”)

237

238

239 #create image for map file map=ii[0]

240 med=imstat (imagename=str(ii [0]) ,box=str(ii [2])+”,”+str(ii [3])+”,”+str( i i [ 4 ] )+”,”+str(ii[5]))

241 meda=med [ ' median ' ] [ 0 ]

242 medb=med [ ' medabsdevmed ' ] [ 0 ]

243 medc=med [ ' sigma ' ] [ 0 ]

244 hdu = f i t s .open(ii[0])[0]

245 image data = hdu.data[0][0]

246 ax = plt.subplot(111)#,projection=proj)

247 im=ax.imshow(image data ,vmin= 1.1 ∗ scalemax ,vmax=1.1∗ scalemax , origin=” lower” ,cmap= ' coolwarm ' )#vmin and vmax set to be stand values here, can add vmin and vmax for individual maps later if needed

248 plt.colorbar(im)

249 rect = patches.Rectangle((int(ii[2]),int(ii[3])),int(ii[4]) int(ii[2])

,int(ii[5]) int(ii [3]) , fill=False ,linewidth=1,edgecolor= ' r ' )

250 ax . add patch(rect)

251 ax.text(240, 230, ' median= %.2f \n STD= %.2f ' % (meda,medc), style=' i t a l i c ' , bbox={ ' f a c e c o l o r ' : ' wheat ' , ' alpha ' : 0 . 2 , ' pad ' : 1 0 } )

252 ax . p l o t ( [int(ii[6]), int(ii[6])], [int(ii[7]) 35,int(ii [7])+35], ' k ' , lw=1) 158

253 ax . p l o t ( [int(ii[6]) 50,int(ii[6])+50], [int(ii[7]),int(ii[7])], ' k ' , lw=1)

254 p l t . xlim (int(ii[8]),int(ii[9]))

255 p l t . ylim (int(ii[10]),int(ii[11]))

256 imoutname=str(ii[0])[: 5] +”.png”

257 plt . savefig(imoutname)

258 os . system (”cpf” + imoutname +”../ ImagesCombined/”+ str(ii [ 0 ] [ : 5 ] ) )

259 plt.close()

260

261

262 endTime=datetime . datetime .now()

263 p r i n t”start time=”+ str(startTime)

264 p r i n t”end time=”+ str (endTime)

265 p r i n t”time taken=”+ str(endTime startTime)