viscid.calculator.mpause module

Minimum Variance Analysis and boundary normal crd tools

viscid.calculator.mpause.paraboloid(y, z, x0, y0, z0, ax, ay, az)[source]

Generic paraboloid function

viscid.calculator.mpause.paraboloid_normal(y, z, x0, y0, z0, ax, ay, az, normalize=True)[source]

Normal vector of a generic paraboloid

viscid.calculator.mpause.fit_paraboloid(fld, p0=(9.0, 0.0, 0.0, 1.0, -1.0, -1.0), tolerance=0.0)[source]

Fit paraboloid it GSE coordinates x ~ y**2 + z**2

Parameters:
  • fld (viscid.field.ScalarField) – field of x values
  • p0 (sequence) – initial guess for parabaloid (x0, y0, z0, ax, ay, az), where (x0, y0, z0) is the nose location (should be subsolar for 0 dipole tilt), and the ay, az, and az coefficients determine the curvature
Returns:

record array of parameters with length 2; the

1st value is the fit value, and the 2nd is one sigma of the fit

Return type:

numpy.recarray

viscid.calculator.mpause.get_mp_info(pp, b, j, e, cache=True, cache_dir=None, slc='x=5.5j:11.0j, y=-4.0j:4.0j, z=-3.6j:3.6j', fit='mp_xloc', fit_p0=(9.0, 0.0, 0.0, 1.0, -1.0, -1.0))[source]

Get info about m-pause as flattened fields

Notes

The first thing this function does is mask locations where the GSE-y current density < 1e-4. This masks out the bow shock and current free regions. This works for southward IMF, but it is not very general.

Parameters:
  • pp (ScalarcField) – pressure
  • b (VectorField) – magnetic field
  • j (VectorField) – current density
  • e (VectorField, None) – electric field (same centering as b). If None, then the info that requires E will be filled with NaN
  • cache (bool, str) – Save to and load from cache, if “force”, then don’t load from cache if it exists, but do save a cache at the end
  • cache_dir (str) – Directory for cache, if None, same directory as that file to which the grid belongs
  • slc (str) – slice that gives a box that contains the m-pause
  • fit (str) – to which resulting field should the paraboloid be fit, defaults to mp_xloc, but pp_max_xloc might be useful in some circumstances
  • fit_p0 (tuple) – Initial guess vector for paraboloid fit
Returns:

Unless otherwise noted, the entiries are 2D (y-z) fields

  • mp_xloc location of minimum abs(Bz), this works better than max of J^2 for FTEs
  • mp_sheath_edge location where Jy > 0.1 * Jy when coming in from the sheath side
  • mp_sphere_edge location where Jy > 0.1 * Jy when coming in from the sphere side
  • mp_width difference between m-sheath edge and msphere edge
  • mp_shear magnetic shear taken 6 grid points into the m-sheath / m-sphere
  • pp_max max pp
  • pp_max_xloc location of max pp
  • epar_max max e parallel
  • epar_max_xloc location of max e parallel
  • paraboloid numpy.recarray of paraboloid fit. The parameters are given in the 0th element, and the 1st element contains the 1-sigma values for the fit

Return type:

dict

Raises:

RuntimeError – if using MHD crds instead of GSE crds

viscid.calculator.mpause.find_mp_edges(j_block, msphere_thresh=0.1, sheath_thresh=0.1, maskval=0.0001)[source]

Find x location of msphere and msheath edges using current (J)

Note

GSE coordinates only please

Parameters:
  • j_block (VectorField) – Current density containing the whole magnetopause
  • msphere_thresh (float) – thereshold of current on the magnetosphere side as a fraction of the maximum current density, i.e., 0.1 is 10% of the max
  • sheath_thresh (float) – thereshold of current on the magnetosheath side as a fraction of the maximum current density, i.e., 0.1 is 10% of the max
  • maskval (float, None) – if not None, then mask out J values less than maskval; useful for masking out bowshock, and current free regions
Returns:

sheath and sphere fields / values

  • sheath_edge: float or 2D ScalarField of x values
  • msphere_edge: float or 2D ScalarField of x values
  • mp_width: sheath_edge - msphere_edge
  • sheath_ind: index of sheath_edge x location
  • sphere_ind: index of msphere_edge x location

Return type:

tuple