PlanetMag manuscript data and figure scripts
CalcBexc()
- publication.CalcBexc()
Calculate excitation moments for all moons using selected eras and default models, in addition to particular selections for Europa and Callisto to allow for comparison to Seufert et al. (2011).
CompareCoords()
- publication.CompareCoords()
Compare phi-Omega frames to IAU frames for moons for which these frames are implemented (the Galilean moons). Prints the angles between x and z axes.
GetNearFarMaxBdiff()
- publication.GetNearFarMaxBdiff()
Calculate the maximum difference in the magnetic field magnitude at the nearest and farthest points relative to the parent planet for moons of concern.
MakeHodograms()
- publication.MakeHodograms()
Print hodograms for each moon implemented in PlanetProfile from the default model data used to calculate the excitation moments.
PrintSurfaceMap()
- publication.PrintSurfaceMap(planet, model, hpDir, hpFname, outDir, outFbase)
Evaluates magnetic field vectors on a HEALpix map at the body surface and prints to disk.
Prints a .mat file for the given planet and model that contains magnetic field vectors at the “surface” of the planet, typically the 1-bar radius defined in IAU reports.
- Parameters:
planet (
char, 1xC
) – Planet name for which to calculate the surface map.model (
int
) – Model index to pass toGetModelOpts()
. If -1 is passed, print maps for all models. If 0 is passed, the default model will be evaluated.hpDir (
char, 1xD, default='publication'
) – Directory containing a file with pixel locations on a HEALpix grid where function outputs are to be compared.hpFname (
char, 1xE, default='healpix_locs.txt'
) – File name where HEALpix locations are stored.outDir (
char, 1xF, default='out'
) – Directory where a file with function outputs will be written.outFbase (
char, 1xG, default='surfaceMap_'
) – File name pattern for function outputs.
RunPublication()
- publication.RunPublication()
Run all scripts needed to produce data and figure products for the publication describing PlanetMag, DOI TBD.
makeSurfaceMaps
Creates magnetic field surface maps for data saved to disk by PrintSurfaceMap(). Run this as a script after running RunPublication() with Matlab.
- publication.makeSurfaceMaps.Cformat(field)
Formatting function for magnetic field contour labels.
- Parameters:
field (float, array-like) – Magnetic field component or magnitude value for contour to label.
- Returns:
fmtString – A string to represent the contour label.
- Return type:
str
- publication.makeSurfaceMaps.EastFormatted(longitude, EAST=True)
Formatting function to pass to axis labelers for longitudes.
- Parameters:
longitude (float, array-like) – Longitude for which to generate tick labels.
EAST (bool, default=True) – Whether to treat longitude values as all east (used in maps running from 0–360).
- Returns:
fmtString – A string to represent the passed longitude for a given axis tick.
- Return type:
str
- publication.makeSurfaceMaps.FixLons(lons)
Configure longitudes to be from 0 to 360.
- Parameters:
lons (float, array-like) – Longitude(s) to adjust to be between 0 and 360.
- Returns:
lons – Adjusted longitudes.
- Return type:
float, array-like
- publication.makeSurfaceMaps.GetSign(val)
Get + or - for text labels of numbers that may be negative.
- Parameters:
val (float) – Value for which to get + or - sign.
- Returns:
sign – A string to prepend to text labels that may be negative.
- Return type:
str
- publication.makeSurfaceMaps.LatFormatted(latitude)
Formatting function to pass to axis labelers for latitudes.
- Parameters:
latitude (float, array-like) – Latitude for which to generate tick labels.
- Returns:
fmtString – A string to represent the passed latitude for a given axis tick.
- Return type:
str
- publication.makeSurfaceMaps.LatHemisphere(latitude)
Retrieve the N/S hemisphere letter for degree unit labels.
- Parameters:
latitude (float, array-like) – Latitude for which to retrieve hemisphere letter.
- Returns:
hemisphere – A string to accompany degree units in map labels to label the hemisphere. Either nothing (for 0), N, or S.
- Return type:
str
- publication.makeSurfaceMaps.LonHemisphere(longitude, EAST=True)
Retrieve the E/W hemisphere letter for degree unit labels.
- Parameters:
longitude (float, array-like) – Longitude for which to retrieve hemisphere letter.
EAST (bool, default=True) – Whether to treat longitude values as all east (used in maps running from 0–360).
- Returns:
hemisphere – A string to accompany degree units in map labels to label the hemisphere. Either nothing (for 0), E, or W.
- Return type:
str
- publication.makeSurfaceMaps.SetMap(ax)
Format axis labels as a cylindrical projection map.
- Parameters:
ax (matplotlib.axes._axes.Axes) – Axis object to format as a map.
- publication.makeSurfaceMaps.healpixMap(ax, Bplot_G, vecComp, title, levels=None, cmap=None)
- Parameters:
ax (matplotlib.axes._axes.Axes) – Axis object for the given map.
Bplot_G (float, array-like) – Magnetic field map of the selected vector component at evaluated HEALpix pixels.
vecComp (str) – Vector component to use for map plotting. Options are ‘x’, ‘y’, ‘z’, ‘r’, ‘theta’, ‘phi’, and ‘mag’.
title (str) – Title string for placing at the top the plot.
levels (float, array-like, default=None) – Contour levels to pass to ax.contour method.
cmap (str, default=None) – Colormap identifier string to pass to ax.pcolormesh method.
- publication.makeSurfaceMaps.loadSurfaceMap(planet, model=None, ioDir='publication', fBase='surfMap_', vecComp='mag')
Load data from disk for a magnetic field surface map.
- Parameters:
planet (str) – Planet for which to load saved data.
model (int or str, default=None) – Index number for model to load, as needed to complete the file name, or ‘all’.
ioDir (str, default='publication') – Directory name relative to run dir where data files are found.
fBase (str, default='surfMap_') – Filename pattern base to use for loading data files.
vecComp (str, default='mag') – Vector component to use for map plotting. Options are ‘x’, ‘y’, ‘z’, ‘r’, ‘theta’, ‘phi’, and ‘mag’.
- Returns:
Bout_G (list of float, array-like) – Magnetic field map of the selected vector component at evaluated HEALpix pixels.
titles (list of str) – Title strings for placing at the top of each plot axis object.
inpFile (list of str) – File paths sans extension used for each surface map.
- publication.makeSurfaceMaps.plotAllIndividual()
Plot magnetic field surface maps from data saved to disk, separately.
- publication.makeSurfaceMaps.plotDefaultTogether(fBase='surfMap_')
Plot magnetic field surface maps for each planet, all together in one figure.
- Parameters:
fBase (str, default='surfMap_') – Filename pattern base to use for loading data files.
hodogram
Functions for loading data and printing individual hodograms for each moon.
- functions.plotting.hodogram.loaddat(planet, moonName, model=None, datDir='out', figDir='figures')
Load time series data from disk and format into horizontal and vertical for hodogram plotting.
- Parameters:
planet (str) – Name of parent planet for hodogram data to load.
moonName (str) – Name of moon for hodogram data to load.
model (int, default=None) – Model index number as defined in GetModelOpts. Passing None selects the default.
datDir (str, default='out') – Data directory from which to load FFT data.
figDir (str, default='figures') – Output directory for figure files.
- Returns:
xx (float, shape 1xN) – Selected \(\vec{B}\) component for plotting on the \(x\) axis in hodogram plot. The selected component depends on the moon, so that the most interesting components are plotted.
yy (float, shape 1xN) – Selected \(\vec{B}\) component for plotting on the \(x\) axis in hodogram plot. The selected component depends on the moon, so that the most interesting components are plotted.
xlabel (str) – Text to display for label on x axis.
ylabel (str) – Text to display for label on y axis.
title (str) – Text to display at top for plot title.
figFile (str) – Output file name for figure to print, including extension.
- functions.plotting.hodogram.plotHodogramSingle(xx, yy, xlabel, ylabel, title, figFile, deftFigsize=None)
Plots a single hodogram figure for given input data and labels.
- Parameters:
xx (float, shape 1xN) – \(x\) axis data for hodogram plot.
yy (float, shape 1xN) – \(y\) axis data for hodogram plot.
xlabel (str) – Text to display for label on x axis.
ylabel (str) – Text to display for label on y axis.
title (str) – Text to display at top for plot title.
figFile (str) – Output file name for figure to print, including extension.
deftFigsize (tuple of float, shape 1x2, default=None) – Default figure size in screen inches (the default of matplotlib).
plotFFT
Functions for plotting Fast Fourier Transform (FFT) data.
- functions.plotting.plotFFT.loaddat(moonName, datDir='out', figDir='figures')
Reloads FFT data from disk into numpy arrays.
- Parameters:
moonName (str) – Name of moon to use for reloading data.
datDir (str, default='out') – Data directory from which to load FFT data.
figDir (str, default='figures') – Output directory for figure files.
- Returns:
T_h (float, shape 1xN) – Periods for excitation spectrum data in hours, i.e.the x axis values.
BxFFT_nT (float, shape 1xN) – Magnitude of the \(\hat{x}\) component of the excitation spectrum power for each period.
ByFFT_nT (float, shape 1xN) – Magnitude of the \(\hat{y}\) component of the excitation spectrum power for each period.
BzFFT_nT (float, shape 1xN) – Magnitude of the \(\hat{z}\) component of the excitation spectrum power for each period.
xlabel (str) – Text to display for label on x axis.
ylabel (str) – Text to display for label on y axis.
title (str) – Text to display at top for plot title.
figFile (str) – Output file name for figure to print, including extension.
- functions.plotting.plotFFT.plotFFTSingle(T_h, BxFFT_nT, ByFFT_nT, BzFFT_nT, xlabel, ylabel, title, figFile, deftFigsize=None, LW=None)
Plot Fast Fourier Transform (FFT) data for a single excitation spectrum.
- Parameters:
T_h (float, shape 1xN) – Periods for excitation spectrum data in hours, i.e.the x axis values.
BxFFT_nT (float, shape 1xN) – Magnitude of the \(\hat{x}\) component of the excitation spectrum power for each period.
ByFFT_nT (float, shape 1xN) – Magnitude of the \(\hat{y}\) component of the excitation spectrum power for each period.
BzFFT_nT (float, shape 1xN) – Magnitude of the \(\hat{z}\) component of the excitation spectrum power for each period.
xlabel (str) – Text to display for label on x axis.
ylabel (str) – Text to display for label on y axis.
title (str) – Text to display at top for plot title.
figFile (str) – Output file name for figure to print, including extension.
deftFigsize (tuple of float, shape 1x2, default=None) – Default figure size in screen inches (the default of matplotlib).
LW (float, default=None) – Linewidth in pt.