code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
# no Test case for these # elif isinstance(t, typedesc.Argument): # elif isinstance(t, typedesc.CvQualifiedType): # elif isinstance(t, typedesc.Variable): # return "%s" % self.type_name(t.typ, generate) # elif isinstance(t, typedesc.Enumeration): # re...
def type_name(self, t, generate=True)
Returns a string containing an expression that can be used to refer to the type. Assumes the 'from ctypes import *' namespace is available.
2.982191
2.920622
1.021081
# FIXME if self.generate_comments: self.print_comment(alias) print("%s = %s # alias" % (alias.name, alias.alias), file=self.stream) self._aliases += 1 return
def Alias(self, alias)
Handles Aliases. No test cases yet
7.401573
7.226116
1.024281
if macro.location is None: log.info('Ignoring %s with no location', macro.name) return if self.generate_locations: print("# %s:%s" % (macro.location), file=self.stream) if self.generate_comments: self.print_comment(macro) print("%s...
def Macro(self, macro)
Handles macro. No test cases else that #defines.
4.218747
4.064962
1.037832
if item in self.done: return None if isinstance(item, typedesc.FundamentalType): return None if isinstance(item, typedesc.PointerType): return self.get_undeclared_type(item.typ) if isinstance(item, typedesc.ArrayType): return self....
def get_undeclared_type(self, item)
Checks if a typed has already been declared in the python output or is a builtin python type.
3.383924
3.169788
1.067555
log.debug('HERE in FundamentalType for %s %s', _type, _type.name) if _type.name in ["None", "c_long_double_t", "c_uint128", "c_int128"]: self.enable_fundamental_type_wrappers() return _type.name return "ctypes.%s" % (_type.name)
def FundamentalType(self, _type)
Returns the proper ctypes class name for a fundamental type 1) activates generation of appropriate headers for ## int128_t ## c_long_double_t 2) return appropriate name for type
6.302347
4.665782
1.350759
if item in self.done: return # verbose output with location. if self.generate_locations and item.location: print("# %s:%d" % item.location, file=self.stream) if self.generate_comments: self.print_comment(item) log.debug("generate %s, %...
def _generate(self, item, *args)
wraps execution of specific methods.
4.4408
4.32977
1.025643
ldata = 200 degrees = np.arange(ldata+1, dtype=float) degrees[0] = np.inf power = degrees**(-1) clm1 = pyshtools.SHCoeffs.from_random(power, exact_power=False) clm2 = pyshtools.SHCoeffs.from_random(power, exact_power=True) fig, ax = plt.subplots() ax.plot(clm1.spectrum(unit='per_l...
def example()
Plot random phase and Gaussian random variable spectra.
3.644089
3.421985
1.064905
if ax is None: fig, axes = self.rad.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if show: fig.show() if fname is not None: ...
def plot_rad(self, colorbar=True, cb_orientation='vertical', cb_label='$g_r$, m s$^{-2}$', ax=None, show=True, fname=None, **kwargs)
Plot the radial component of the gravity field. Usage ----- x.plot_rad([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname, **kwargs]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] ...
1.73666
2.046936
0.848419
if ax is None: fig, axes = self.theta.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if show: ...
def plot_theta(self, colorbar=True, cb_orientation='vertical', cb_label='$g_\\theta$, m s$^{-2}$', ax=None, show=True, fname=None, **kwargs)
Plot the theta component of the gravity field. Usage ----- x.plot_theta([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname, **kwargs]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30...
1.713806
1.998569
0.857517
if ax is None: fig, axes = self.phi.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if show: fig.show() if fname is not None: ...
def plot_phi(self, colorbar=True, cb_orientation='vertical', cb_label='$g_\phi$, m s$^{-2}$', ax=None, show=True, fname=None, **kwargs)
Plot the phi component of the gravity field. Usage ----- x.plot_phi([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname, **kwargs]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] ...
1.761052
2.096796
0.839878
if self.normal_gravity is True: if cb_label is None: cb_label = 'Gravity disturbance, mGal' else: if cb_label is None: cb_label = 'Gravity disturbance, m s$^{-2}$' if ax is None: if self.normal_gravity is True: ...
def plot_total(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the total gravity disturbance. Usage ----- x.plot_total([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname, **kwargs]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] ...
1.79297
1.736164
1.032719
if ax is None: fig, axes = self.pot.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if show: fig.show() if fname is not None: ...
def plot_pot(self, colorbar=True, cb_orientation='vertical', cb_label='Potential, m$^2$ s$^{-2}$', ax=None, show=True, fname=None, **kwargs)
Plot the gravitational potential. Usage ----- x.plot_pot([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname, **kwargs]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Int...
1.706247
2.034143
0.838804
if colorbar is True: if cb_orientation == 'horizontal': scale = 0.8 else: scale = 0.5 else: scale = 0.6 figsize = (_mpl.rcParams['figure.figsize'][0], _mpl.rcParams['figure.figsize'][0] * scale) ...
def plot(self, colorbar=True, cb_orientation='horizontal', tick_interval=[60, 60], minor_tick_interval=[20, 20], xlabel='Longitude', ylabel='Latitude', axes_labelsize=9, tick_labelsize=8, show=True, fname=None, **kwargs)
Plot the three vector components of the gravity field and the gravity disturbance. Usage ----- x.plot([tick_interval, minor_tick_interval, xlabel, ylabel, colorbar, cb_orientation, cb_label, axes_labelsize, tick_labelsize, show, fname, **kwargs]) ...
1.477131
1.558381
0.947863
if type(grid) != str: raise ValueError('grid must be a string. ' + 'Input type was {:s}' .format(str(type(grid)))) if nmax is None: nmax = self.nmax if self.galpha.kind == 'cap': shcoeffs = _...
def expand(self, nmax=None, grid='DH2', zeros=None)
Expand the function on a grid using the first n Slepian coefficients. Usage ----- f = x.expand([nmax, grid, zeros]) Returns ------- f : SHGrid class instance Parameters ---------- nmax : int, optional, default = x.nmax The number of ...
2.636478
2.569355
1.026125
if type(normalization) != str: raise ValueError('normalization must be a string. ' + 'Input type was {:s}' .format(str(type(normalization)))) if normalization.lower() not in set(['4pi', 'ortho', 'schmidt']): rais...
def to_shcoeffs(self, nmax=None, normalization='4pi', csphase=1)
Return the spherical harmonic coefficients using the first n Slepian coefficients. Usage ----- s = x.to_shcoeffs([nmax]) Returns ------- s : SHCoeffs class instance The spherical harmonic coefficients obtained from using the first n Slep...
2.430209
2.405719
1.01018
''' Determine error message to print when a SHTOOLS Fortran 95 routine exits improperly. ''' if (status == 1): errmsg = 'Improper dimensions of input array.' elif (status == 2): errmsg = 'Improper bounds for input variable.' elif (status == 3): errmsg = 'Error allocat...
def _shtools_status_message(status)
Determine error message to print when a SHTOOLS Fortran 95 routine exits improperly.
4.836959
2.881132
1.67884
if theta_degrees: tapers, eigenvalues, taper_order = _shtools.SHReturnTapers( _np.radians(theta), lmax) else: tapers, eigenvalues, taper_order = _shtools.SHReturnTapers( theta, lmax) return SlepianCap(theta, tapers, eigenvalues, t...
def from_cap(cls, theta, lmax, clat=None, clon=None, nmax=None, theta_degrees=True, coord_degrees=True, dj_matrix=None)
Construct spherical cap Slepian functions. Usage ----- x = Slepian.from_cap(theta, lmax, [clat, clon, nmax, theta_degrees, coord_degrees, dj_matrix]) Returns ------- x : Slepian class instance Parameters ------...
3.593344
4.116504
0.872912
if nmax is None: nmax = (lmax + 1)**2 else: if nmax > (lmax + 1)**2: raise ValueError('nmax must be less than or equal to ' + '(lmax + 1)**2. lmax = {:d} and nmax = {:d}' .format(lmax, nmax...
def from_mask(cls, dh_mask, lmax, nmax=None)
Construct Slepian functions that are optimally concentrated within the region specified by a mask. Usage ----- x = Slepian.from_mask(dh_mask, lmax, [nmax]) Returns ------- x : Slepian class instance Parameters ---------- dh_mask :ndarray...
2.963971
2.83879
1.044097
if nmax is None: nmax = (self.lmax+1)**2 elif nmax is not None and nmax > (self.lmax+1)**2: raise ValueError( "nmax must be less than or equal to (lmax+1)**2 " + "where lmax is {:s}. Input value is {:s}" .format(repr(self.l...
def expand(self, flm, nmax=None)
Return the Slepian expansion coefficients of the input function. Usage ----- s = x.expand(flm, [nmax]) Returns ------- s : SlepianCoeff class instance The Slepian expansion coefficients of the input function. Parameters ---------- fl...
3.337901
3.275884
1.018931
if alpha is None: if nmax is None: nmax = self.nmax spectra = _np.zeros((self.lmax+1, nmax)) for iwin in range(nmax): coeffs = self.to_array(iwin) spectra[:, iwin] = _spectrum(coeffs, normalization='4pi', ...
def spectra(self, alpha=None, nmax=None, convention='power', unit='per_l', base=10.)
Return the spectra of one or more Slepian functions. Usage ----- spectra = x.spectra([alpha, nmax, convention, unit, base]) Returns ------- spectra : ndarray, shape (lmax+1, nmax) A matrix with each column containing the spectrum of a Slepian f...
2.673187
2.767267
0.966002
if self.coeffs is None: self.rotate(clat=90., clon=0., nrot=nmax) falpha = _shtools.SlepianCoeffs(self.coeffs, coeffsin, self.nrot) else: falpha = _shtools.SlepianCoeffs(self.coeffs, coeffsin, self.nrot) return SlepianCoeffs(falpha, self)
def _expand(self, coeffsin, nmax)
Determine the Slepian expansion coefficients of a function.
5.011766
4.501101
1.113453
taperm = self.orders[alpha] coeffs = _np.zeros((2, self.lmax + 1, self.lmax + 1)) if taperm < 0: coeffs[1, :, abs(taperm)] = self.tapers[:, alpha] else: coeffs[0, :, abs(taperm)] = self.tapers[:, alpha] return coeffs
def _taper2coeffs(self, alpha)
Return the spherical harmonic coefficients of the unrotated Slepian function i as an array, where i = 0 is the best concentrated function.
3.938465
3.9328
1.001441
if self.coeffs is None: coeffs = _np.copy(self._taper2coeffs(alpha)) else: if alpha > self.nrot - 1: raise ValueError('alpha must be less than or equal to ' + 'nrot - 1. alpha = {:d}, nrot = {:d}' ...
def _to_array(self, alpha, normalization='4pi', csphase=1)
Return the spherical harmonic coefficients of Slepian function i as an array, where i = 0 is the best concentrated function.
3.279573
3.184323
1.029912
falpha = _shtools.SlepianCoeffs(self.tapers, coeffsin, nmax) return SlepianCoeffs(falpha, self)
def _expand(self, coeffsin, nmax)
Determine the Slepian expansion coefficients of a function.
10.318316
7.798131
1.323178
coeffs = _shtools.SHVectorToCilm(self.tapers[:, alpha]) if normalization == 'schmidt': for l in range(self.lmax + 1): coeffs[:, l, :l+1] *= _np.sqrt(2.0 * l + 1.0) elif normalization == 'ortho': coeffs *= _np.sqrt(4.0 * _np.pi) if csphas...
def _to_array(self, alpha, normalization='4pi', csphase=1)
Return the spherical harmonic coefficients of Slepian function i as an array, where i=0 is the best concentrated function.
3.433356
3.399576
1.009936
if ax is None: fig, axes = self.total.plot( colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if show: fig.show() if fname is not None: fig.savefig(fname) ...
def plot_total(self, colorbar=True, cb_orientation='vertical', cb_label='$|B|$, nT', ax=None, show=True, fname=None, **kwargs)
Plot the total magnetic intensity. Usage ----- x.plot_total([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname, **kwargs]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] ...
1.715566
2.058744
0.833307
if _np.iscomplexobj(coeffs): raise TypeError('The input array must be real.') if type(normalization) != str: raise ValueError('normalization must be a string. ' 'Input type was {:s}' .format(str(type(normalizatio...
def from_array(self, coeffs, r0, errors=None, normalization='schmidt', csphase=1, lmax=None, copy=True)
Initialize the class with spherical harmonic coefficients from an input array. Usage ----- x = SHMagCoeffs.from_array(array, r0, [errors, normalization, csphase, lmax, copy]) Returns ------- x : SHMagCoeffs class in...
2.029154
1.843296
1.100829
# Ensure that the type is correct values = _np.array(values) ls = _np.array(ls) ms = _np.array(ms) mneg_mask = (ms < 0).astype(_np.int) self.coeffs[mneg_mask, ls, _np.abs(ms)] = values
def set_coeffs(self, values, ls, ms)
Set spherical harmonic coefficients in-place to specified values. Usage ----- x.set_coeffs(values, ls, ms) Parameters ---------- values : float (list) The value(s) of the spherical harmonic coefficient(s). ls : int (list) The degree(s) of...
4.069285
4.255247
0.956298
if normalization is None: normalization = self.normalization if csphase is None: csphase = self.csphase if lmax is None: lmax = self.lmax coeffs = _convert(self.coeffs, normalization_in=self.normalization, normalizat...
def to_array(self, normalization=None, csphase=None, lmax=None)
Return spherical harmonic coefficients (and errors) as a numpy array. Usage ----- coeffs, [errors] = x.to_array([normalization, csphase, lmax]) Returns ------- coeffs : ndarry, shape (2, lmax+1, lmax+1) numpy ndarray of the spherical harmonic coefficients. ...
1.57257
1.599988
0.982864
if normalization is None: normalization = self.normalization if csphase is None: csphase = self.csphase if lmax is None: lmax = self.lmax # check argument consistency if type(normalization) != str: raise ValueError('normal...
def convert(self, normalization=None, csphase=None, lmax=None)
Return an SHMagCoeffs class instance with a different normalization convention. Usage ----- clm = x.convert([normalization, csphase, lmax]) Returns ------- clm : SHMagCoeffs class instance Parameters ---------- normalization : str, optio...
1.819914
1.698618
1.071408
clm = self.copy() if lmax <= self.lmax: clm.coeffs = clm.coeffs[:, :lmax+1, :lmax+1] clm.mask = clm.mask[:, :lmax+1, :lmax+1] if self.errors is not None: clm.errors = clm.errors[:, :lmax+1, :lmax+1] else: clm.coeffs = _np....
def pad(self, lmax)
Return an SHMagCoeffs class where the coefficients are zero padded or truncated to a different lmax. Usage ----- clm = x.pad(lmax) Returns ------- clm : SHMagCoeffs class instance Parameters ---------- lmax : int Maximum sphe...
1.786165
1.832826
0.974541
if lmax is None: lmax = self.lmax clm = self.pad(lmax) if r0 is not None and r0 != self.r0: for l in _np.arange(lmax+1): clm.coeffs[:, l, :l+1] *= (self.r0 / r0)**(l+2) if self.errors is not None: clm.errors[:...
def change_ref(self, r0=None, lmax=None)
Return a new SHMagCoeffs class instance with a different reference r0. Usage ----- clm = x.change_ref([r0, lmax]) Returns ------- clm : SHMagCoeffs class instance. Parameters ---------- r0 : float, optional, default = self.r0 The ref...
2.857186
2.89627
0.986505
if a is None: a = self.r0 if f is None: f = 0. if lmax is None: lmax = self.lmax if lmax_calc is None: lmax_calc = lmax if self.errors is not None: coeffs, errors = self.to_array(normalization='schmidt', csphas...
def expand(self, a=None, f=None, lmax=None, lmax_calc=None, sampling=2)
Create 2D cylindrical maps on a flattened and rotating ellipsoid of all three components of the magnetic field, the total magnetic intensity, and the magnetic potential, and return as a SHMagGrid class instance. Usage ----- mag = x.expand([a, f, lmax, lmax_calc, sampling]) ...
3.104939
2.567515
1.209317
if line.isspace(): return True elif len(line.split()) >= 3: try: # python 3 str if line.split()[0].isdecimal() and line.split()[1].isdecimal(): return False except: # python 2 str if (line.decode().split()[0].isdecimal() and ...
def _iscomment(line)
Determine if a line is a comment line. A valid line contains at least three words, with the first two being integers. Note that Python 2 and 3 deal with strings differently.
3.248134
2.876065
1.129367
# ---- split f2py document in its parts # 0=Call Signature # 1=Parameters # 2=Other (optional) Parameters (only if present) # 3=Returns docparts = re.split('\n--', f2pydoc) if len(docparts) == 4: doc_has_optionals = True elif len(docparts) == 3: doc_has_optionals = ...
def process_f2pydoc(f2pydoc)
this function replace all optional _d0 arguments with their default values in the function signature. These arguments are not intended to be used and signify merely the array dimensions of the associated argument.
4.543833
4.115574
1.104058
if theta_degrees: tapers, eigenvalues, taper_order = _shtools.SHReturnTapers( _np.radians(theta), lwin) else: tapers, eigenvalues, taper_order = _shtools.SHReturnTapers( theta, lwin) return SHWindowCap(theta, tapers, eigenvalues, ...
def from_cap(cls, theta, lwin, clat=None, clon=None, nwin=None, theta_degrees=True, coord_degrees=True, dj_matrix=None, weights=None)
Construct spherical cap localization windows. Usage ----- x = SHWindow.from_cap(theta, lwin, [clat, clon, nwin, theta_degrees, coord_degrees, dj_matrix, weights]) Returns ------- x : SHWindow class instance Parameters...
3.622627
3.680443
0.984291
if nwin is None: nwin = (lwin + 1)**2 else: if nwin > (lwin + 1)**2: raise ValueError('nwin must be less than or equal to ' + '(lwin + 1)**2. lwin = {:d} and nwin = {:d}' .format(lwin, nwin...
def from_mask(cls, dh_mask, lwin, nwin=None, weights=None)
Construct localization windows that are optimally concentrated within the region specified by a mask. Usage ----- x = SHWindow.from_mask(dh_mask, lwin, [nwin, weights]) Returns ------- x : SHWindow class instance Parameters ---------- dh...
3.098976
2.832755
1.093979
if type(normalization) != str: raise ValueError('normalization must be a string. ' + 'Input type was {:s}' .format(str(type(normalization)))) if normalization.lower() not in ('4pi', 'ortho', 'schmidt'): raise Val...
def to_array(self, itaper, normalization='4pi', csphase=1)
Return the spherical harmonic coefficients of taper i as a numpy array. Usage ----- coeffs = x.to_array(itaper, [normalization, csphase]) Returns ------- coeffs : ndarray, shape (2, lwin+1, lwin+11) 3-D numpy ndarray of the spherical harmonic coeffic...
2.031988
2.130975
0.953549
if type(normalization) != str: raise ValueError('normalization must be a string. ' + 'Input type was {:s}' .format(str(type(normalization)))) if normalization.lower() not in set(['4pi', 'ortho', 'schmidt']): rais...
def to_shcoeffs(self, itaper, normalization='4pi', csphase=1)
Return the spherical harmonic coefficients of taper i as a SHCoeffs class instance. Usage ----- clm = x.to_shcoeffs(itaper, [normalization, csphase]) Returns ------- clm : SHCoeffs class instance Parameters ---------- itaper : int ...
1.996986
2.057261
0.970702
if type(grid) != str: raise ValueError('grid must be a string. ' + 'Input type was {:s}' .format(str(type(grid)))) if grid.upper() in ('DH', 'DH1'): gridout = _shtools.MakeGridDH(self.to_array(itaper), sampling=1...
def to_shgrid(self, itaper, grid='DH2', zeros=None)
Evaluate the coefficients of taper i on a spherical grid and return a SHGrid class instance. Usage ----- f = x.to_shgrid(itaper, [grid, zeros]) Returns ------- f : SHGrid class instance Parameters ---------- itaper : int Tape...
2.314469
2.214828
1.044988
return self._multitaper_spectrum(clm, k, convention=convention, unit=unit, **kwargs)
def multitaper_spectrum(self, clm, k, convention='power', unit='per_l', **kwargs)
Return the multitaper spectrum estimate and standard error. Usage ----- mtse, sd = x.multitaper_spectrum(clm, k, [convention, unit, lmax, taper_wt, clat, clon, coord_degrees]) Returns ...
2.410269
5.533176
0.435603
return self._multitaper_cross_spectrum(clm, slm, k, convention=convention, unit=unit, **kwargs)
def multitaper_cross_spectrum(self, clm, slm, k, convention='power', unit='per_l', **kwargs)
Return the multitaper cross-spectrum estimate and standard error. Usage ----- mtse, sd = x.multitaper_cross_spectrum(clm, slm, k, [convention, unit, lmax, taper_wt, clat, cl...
2.28215
4.49076
0.508188
return self._biased_spectrum(power, k, convention=convention, unit=unit, **kwargs)
def biased_spectrum(self, power, k, convention='power', unit='per_l', **kwargs)
Calculate the multitaper (cross-)spectrum expectation of a localized function. Usage ----- outspectrum = x.biased_spectrum(spectrum, k, [unit, power, taper_wt, save_cg, ldata]) Returns ------- outspectrum : n...
2.634682
6.345843
0.415182
if itaper is None: if nwin is None: nwin = self.nwin spectra = _np.zeros((self.lwin+1, nwin)) for iwin in range(nwin): coeffs = self.to_array(iwin) spectra[:, iwin] = _spectrum(coeffs, normalization='4pi', ...
def spectra(self, itaper=None, nwin=None, convention='power', unit='per_l', base=10.)
Return the spectra of one or more localization windows. Usage ----- spectra = x.spectra([itaper, nwin, convention, unit, base]) Returns ------- spectra : ndarray, shape (lwin+1, nwin) A matrix with each column containing the spectrum of a local...
2.518591
2.397177
1.050649
if weights is not None: if nwin is not None: if len(weights) != nwin: raise ValueError( 'Length of weights must be equal to nwin. ' + 'len(weights) = {:d}, nwin = {:d}'.format(len(weights), ...
def coupling_matrix(self, lmax, nwin=None, weights=None, mode='full')
Return the coupling matrix of the first nwin tapers. This matrix relates the global power spectrum to the expectation of the localized multitaper spectrum. Usage ----- Mmt = x.coupling_matrix(lmax, [nwin, weights, mode]) Returns ------- Mmt : ndarray, sh...
1.841015
1.787617
1.029871
figsize = (_mpl.rcParams['figure.figsize'][0], _mpl.rcParams['figure.figsize'][0]) if axes_labelsize is None: axes_labelsize = _mpl.rcParams['axes.labelsize'] if tick_labelsize is None: tick_labelsize = _mpl.rcParams['xtick.labelsize'] ...
def plot_coupling_matrix(self, lmax, nwin=None, weights=None, mode='full', axes_labelsize=None, tick_labelsize=None, show=True, ax=None, fname=None)
Plot the multitaper coupling matrix. This matrix relates the global power spectrum to the expectation of the localized multitaper spectrum. Usage ----- x.plot_coupling_matrix(lmax, [nwin, weights, mode, axes_labelsize, tick_labelsize, show,...
1.603733
1.770346
0.905887
taperm = self.orders[itaper] coeffs = _np.zeros((2, self.lwin + 1, self.lwin + 1)) if taperm < 0: coeffs[1, :, abs(taperm)] = self.tapers[:, itaper] else: coeffs[0, :, abs(taperm)] = self.tapers[:, itaper] return coeffs
def _taper2coeffs(self, itaper)
Return the spherical harmonic coefficients of the unrotated taper i as an array, where i = 0 is the best concentrated.
4.114479
3.992618
1.030522
if self.coeffs is None: coeffs = _np.copy(self._taper2coeffs(itaper)) else: if itaper > self.nwinrot - 1: raise ValueError('itaper must be less than or equal to ' + 'nwinrot - 1. itaper = {:d}, nwinrot = {:d}' ...
def _to_array(self, itaper, normalization='4pi', csphase=1)
Return the spherical harmonic coefficients of taper i as an array, where i = 0 is the best concentrated.
3.349682
3.210892
1.043224
self.coeffs = _np.zeros(((self.lwin + 1)**2, self.nwin)) self.clat = clat self.clon = clon self.coord_degrees = coord_degrees if nwinrot is not None: self.nwinrot = nwinrot else: self.nwinrot = self.nwin if self.coord_degrees: ...
def rotate(self, clat, clon, coord_degrees=True, dj_matrix=None, nwinrot=None)
Rotate the spherical-cap windows centered on the North pole to clat and clon, and save the spherical harmonic coefficients in the attribute coeffs. Usage ----- x.rotate(clat, clon [coord_degrees, dj_matrix, nwinrot]) Parameters ---------- clat, clon : fl...
2.795526
2.263902
1.234826
if nwin is None: nwin = self.nwin if weights is None: weights = self.weights if weights is None: return _shtools.SHMTCouplingMatrix(lmax, self.tapers**2, k=nwin) else: return _shtools.SHMTCouplingMatrix(lmax, self.tapers**2, k=nw...
def _coupling_matrix(self, lmax, nwin=None, weights=None)
Return the coupling matrix of the first nwin tapers.
3.385814
3.065946
1.104329
if lmax is None: lmax = clm.lmax if (clat is not None and clon is not None and clat == self.clat and clon == self.clon and coord_degrees is self.coord_degrees and k <= self.nwinrot): # use the already stored coeffs pass ...
def _multitaper_spectrum(self, clm, k, convention='power', unit='per_l', clat=None, clon=None, coord_degrees=True, lmax=None, taper_wt=None)
Return the multitaper spectrum estimate and standard error for an input SHCoeffs class instance.
2.328032
2.252114
1.03371
if lmax is None: lmax = min(clm.lmax, slm.lmax) if (clat is not None and clon is not None and clat == self.clat and clon == self.clon and coord_degrees is self.coord_degrees and k <= self.nwinrot): # use the already stored coeffs ...
def _multitaper_cross_spectrum(self, clm, slm, k, convention='power', unit='per_l', clat=None, clon=None, coord_degrees=True, lmax=None, taper_wt=None)
Return the multitaper cross-spectrum estimate and standard error for two input SHCoeffs class instances.
2.228705
2.166496
1.028714
coeffs = _shtools.SHVectorToCilm(self.tapers[:, itaper]) if normalization == 'schmidt': for l in range(self.lwin + 1): coeffs[:, l, :l+1] *= _np.sqrt(2.0 * l + 1.0) elif normalization == 'ortho': coeffs *= _np.sqrt(4.0 * _np.pi) if cspha...
def _to_array(self, itaper, normalization='4pi', csphase=1)
Return the spherical harmonic coefficients of taper i as an array, where i=0 is the best concentrated.
3.741787
3.465992
1.079572
if nwin is None: nwin = self.nwin if weights is None: weights = self.weights tapers_power = _np.zeros((self.lwin+1, nwin)) for i in range(nwin): tapers_power[:, i] = _spectrum(self.to_array(i), norm...
def _coupling_matrix(self, lmax, nwin=None, weights=None)
Return the coupling matrix of the first nwin tapers.
4.22186
4.00645
1.053766
if lmax is None: lmax = clm.lmax sh = clm.to_array(normalization='4pi', csphase=1, lmax=lmax) if taper_wt is None: mtse, sd = _shtools.SHMultiTaperMaskSE(sh, self.tapers, lmax=lmax, k=k) else: ...
def _multitaper_spectrum(self, clm, k, convention='power', unit='per_l', lmax=None, taper_wt=None)
Return the multitaper spectrum estimate and standard error for an input SHCoeffs class instance.
2.48546
2.354989
1.055402
if lmax is None: lmax = min(clm.lmax, slm.lmax) sh1 = clm.to_array(normalization='4pi', csphase=1, lmax=lmax) sh2 = slm.to_array(normalization='4pi', csphase=1, lmax=lmax) if taper_wt is None: mtse, sd = _shtools.SHMultiTaperMaskCSE(sh1, sh2, self.taper...
def _multitaper_cross_spectrum(self, clm, slm, k, convention='power', unit='per_l', lmax=None, taper_wt=None)
Return the multitaper cross-spectrum estimate and standard error for two input SHCoeffs class instances.
2.302921
2.186738
1.053131
# The equation is not modified if the in- and out- spectra are power # or energy. However, the convention can not be l2norm, which depends # upon the normalization of the coefficients. if (convention != 'power' and convention != 'energy'): raise ValueError( ...
def _biased_spectrum(self, spectrum, k, convention='power', unit='per_l', **kwargs)
Calculate the multitaper (cross-) spectrum expectation of a function localized by arbitary windows.
3.929859
3.944344
0.996328
self.i0 = self.vxx + self.vyy + self.vzz self.i1 = (self.vxx*self.vyy + self.vyy*self.vzz + self.vxx*self.vzz - self.vxy**2 - self.vyz**2 - self.vxz**2) self.i2 = (self.vxx*(self.vyy*self.vzz - self.vyz**2) + self.vxy*(self.vyz*self.vxz - self.vxy*s...
def compute_invar(self)
Compute the three invariants (I0, I1, I2) of the tensor, as well as the quantity I = -(I2/2)**2 / (I1/3)**3.
2.395625
2.021655
1.184982
self.eig1 = _SHGrid.from_array(_np.zeros_like(self.vxx.data), grid='DH') self.eig2 = _SHGrid.from_array(_np.zeros_like(self.vxx.data), grid='DH') self.eig3 = _SHGrid.from_array(_np.zeros_like(self.vxx.data), ...
def compute_eig(self)
Compute the three eigenvalues of the tensor: eig1, eig2, ei3.
1.758176
1.67733
1.048199
self.eigh1 = _SHGrid.from_array(_np.zeros_like(self.vxx.data), grid='DH') self.eigh2 = _SHGrid.from_array(_np.zeros_like(self.vxx.data), grid='DH') self.eighh = _SHGrid.from_array(_np.zeros_like(self.vxx.dat...
def compute_eigh(self)
Compute the two horizontal eigenvalues of the tensor (eigh1, and eigh2), as well as the combined maximum absolute value of the two (eighh).
1.946044
1.784612
1.090458
if cb_label is None: cb_label = self._vxx_label if ax is None: fig, axes = self.vxx.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vxx(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vxx component of the tensor. Usage ----- x.plot_vxx([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.737735
2.025666
0.857858
if cb_label is None: cb_label = self._vyy_label if ax is None: fig, axes = self.vyy.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vyy(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vyy component of the tensor. Usage ----- x.plot_vyy([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.73791
2.036034
0.853576
if cb_label is None: cb_label = self._vzz_label if ax is None: fig, axes = self.vzz.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vzz(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vzz component of the tensor. Usage ----- x.plot_vzz([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.745698
2.047911
0.852429
if cb_label is None: cb_label = self._vxy_label if ax is None: fig, axes = self.vxy.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vxy(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vxy component of the tensor. Usage ----- x.plot_vxy([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.756477
2.017079
0.870802
if cb_label is None: cb_label = self._vyx_label if ax is None: fig, axes = self.vyx.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vyx(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vyx component of the tensor. Usage ----- x.plot_vyx([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.78252
2.087936
0.853724
if cb_label is None: cb_label = self._vxz_label if ax is None: fig, axes = self.vxz.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vxz(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vxz component of the tensor. Usage ----- x.plot_vxz([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.753365
2.041861
0.858709
if cb_label is None: cb_label = self._vzx_label if ax is None: fig, axes = self.vzx.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vzx(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vzx component of the tensor. Usage ----- x.plot_vzx([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.742828
2.024994
0.860658
if cb_label is None: cb_label = self._vyz_label if ax is None: fig, axes = self.vyz.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vyz(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vyz component of the tensor. Usage ----- x.plot_vyz([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.772613
2.108889
0.840543
if cb_label is None: cb_label = self._vzy_label if ax is None: fig, axes = self.vzy.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb_label=cb_label, show=False, **kwargs) if...
def plot_vzy(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the Vzy component of the tensor. Usage ----- x.plot_vzy([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Intervals...
1.731398
2.032582
0.851822
if cb_label is None: cb_label = self._i0_label if self.i0 is None: self.compute_invar() if ax is None: fig, axes = self.i0.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_i0(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the first invariant I0 (the trace) of the tensor I0 = vxx + vyy + vzz which should be identically zero. Usage ----- x.plot_i0([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------...
1.980922
2.275219
0.870651
if cb_label is None: cb_label = self._i1_label if self.i1 is None: self.compute_invar() if ax is None: fig, axes = self.i1.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_i1(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the second invariant I1 of the tensor: I1 = vxx*vyy + vyy*vzz + vxx*vzz - vxy**2 - vyz**2 - vxz**2 Usage ----- x.plot_i1([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick...
1.969382
2.223373
0.885763
if cb_label is None: cb_label = self._i2_label if self.i2 is None: self.compute_invar() if ax is None: fig, axes = self.i2.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_i2(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the third invariant I2 (the determinant) of the tensor: I2 = vxx*(vyy*vzz - vyz**2) + vxy*(vyz*vxz - vxy*vzz) + vxz*(vxy*vyz - vxz*vyy) Usage ----- x.plot_i2([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname])...
1.972461
2.224842
0.886562
if cb_label is None: cb_label = self._i_label if self.i is None: self.compute_invar() if ax is None: fig, axes = self.i.plot(colorbar=colorbar, cb_orientation=cb_orientation, cb...
def plot_i(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the dimensionless quantity I of Pedersen and Rasmussen (1990) I = -(I2/2)**2 / (I1/3)**3 that is bounded by 0 and 1. Usage ----- x.plot_i([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ...
1.986243
2.260373
0.878724
if colorbar is True: if cb_orientation == 'horizontal': scale = 0.8 else: scale = 0.5 else: scale = 0.6 figsize = (_mpl.rcParams['figure.figsize'][0], _mpl.rcParams['figure.figsize'][0] * scale) ...
def plot_invar(self, colorbar=True, cb_orientation='horizontal', tick_interval=[60, 60], minor_tick_interval=[20, 20], xlabel='Longitude', ylabel='Latitude', axes_labelsize=9, tick_labelsize=8, show=True, fname=None, **kwargs)
Plot the three invariants of the tensor and the derived quantity I. Usage ----- x.plot_invar([tick_interval, minor_tick_interval, xlabel, ylabel, colorbar, cb_orientation, cb_label, axes_labelsize, tick_labelsize, show, fname, **kwargs]) Parameters ...
1.430316
1.488696
0.960785
if cb_label is None: cb_label = self._eig1_label if self.eig1 is None: self.compute_eig() if ax is None: fig, axes = self.eig1.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_eig1(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the first eigenvalue of the tensor. Usage ----- x.plot_eig1([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Inte...
1.777364
2.094292
0.848671
if cb_label is None: cb_label = self._eig2_label if self.eig2 is None: self.compute_eig() if ax is None: fig, axes = self.eig2.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_eig2(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the second eigenvalue of the tensor. Usage ----- x.plot_eig2([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Int...
1.789871
2.113045
0.847058
if cb_label is None: cb_label = self._eig3_label if self.eig3 is None: self.compute_eig() if ax is None: fig, axes = self.eig3.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_eig3(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the third eigenvalue of the tensor. Usage ----- x.plot_eig3([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] Inte...
1.785359
2.106384
0.847594
if colorbar is True: if cb_orientation == 'horizontal': scale = 2.3 else: scale = 1.4 else: scale = 1.65 figsize = (_mpl.rcParams['figure.figsize'][0], _mpl.rcParams['figure.figsize'][0] * scale) ...
def plot_eigs(self, colorbar=True, cb_orientation='vertical', tick_interval=[60, 60], minor_tick_interval=[20, 20], xlabel='Longitude', ylabel='Latitude', axes_labelsize=9, tick_labelsize=8, show=True, fname=None, **kwargs)
Plot the three eigenvalues of the tensor. Usage ----- x.plot_eigs([tick_interval, minor_tick_interval, xlabel, ylabel, colorbar, cb_orientation, cb_label, axes_labelsize, tick_labelsize, show, fname, **kwargs]) Parameters ---------- ...
1.512364
1.597049
0.946974
if cb_label is None: cb_label = self._eigh1_label if self.eigh1 is None: self.compute_eigh() if ax is None: fig, axes = self.eigh1.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_eigh1(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the first eigenvalue of the horizontal tensor. Usage ----- x.plot_eigh1([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] ...
1.747223
1.98045
0.882235
if cb_label is None: cb_label = self._eigh2_label if self.eigh2 is None: self.compute_eigh() if ax is None: fig, axes = self.eigh2.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_eigh2(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the second eigenvalue of the horizontal tensor. Usage ----- x.plot_eigh2([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, default = [30, 30] ...
1.758707
1.9854
0.88582
if cb_label is None: cb_label = self._eighh_label if self.eighh is None: self.compute_eigh() if ax is None: fig, axes = self.eighh.plot(colorbar=colorbar, cb_orientation=cb_orientation, ...
def plot_eighh(self, colorbar=True, cb_orientation='vertical', cb_label=None, ax=None, show=True, fname=None, **kwargs)
Plot the maximum absolute value eigenvalue of the horizontal tensor. Usage ----- x.plot_eighh([tick_interval, xlabel, ylabel, ax, colorbar, cb_orientation, cb_label, show, fname]) Parameters ---------- tick_interval : list or tuple, optional, defau...
1.749699
1.986944
0.880598
if colorbar is True: if cb_orientation == 'horizontal': scale = 2.3 else: scale = 1.4 else: scale = 1.65 figsize = (_mpl.rcParams['figure.figsize'][0], _mpl.rcParams['figure.figsize'][0] * scale) ...
def plot_eigh(self, colorbar=True, cb_orientation='vertical', tick_interval=[60, 60], minor_tick_interval=[20, 20], xlabel='Longitude', ylabel='Latitude', axes_labelsize=9, tick_labelsize=8, show=True, fname=None, **kwargs)
Plot the two eigenvalues and maximum absolute value eigenvalue of the horizontal tensor. Usage ----- x.plot_eigh([tick_interval, minor_tick_interval, xlabel, ylabel, colorbar, cb_orientation, cb_label, axes_labelsize, tick_labelsize, show, fname...
1.600249
1.697888
0.942494
d = os.path.dirname(__file__) # get release number from VERSION with open(os.path.join(d, 'VERSION')) as f: vre = re.compile('.Version: (.+)$', re.M) version = vre.search(f.read()).group(1) if os.path.isdir(os.path.join(d, '.git')): # Get the version using "git describe". ...
def get_version()
Get version from git and VERSION file. In the case where the version is not tagged in git, this function appends .post0+commit if the version has been released and .dev0+commit if the version has not yet been released. Derived from: https://github.com/Changaco/version.py
3.36836
3.021211
1.114904
compiler = get_default_fcompiler() if compiler == 'absoft': flags = ['-m64', '-O3', '-YEXT_NAMES=LCS', '-YEXT_SFX=_', '-fpic', '-speed_math=10'] elif compiler == 'gnu95': flags = ['-m64', '-fPIC', '-O3', '-ffast-math'] elif compiler == 'intel': flags = ['-m6...
def get_compiler_flags()
Set fortran flags depending on the compiler.
5.475964
5.153579
1.062555
config = Configuration('', parent_package, top_path) F95FLAGS = get_compiler_flags() kwargs = { 'libraries': [], 'include_dirs': [], 'library_dirs': [], } kwargs['extra_compile_args'] = F95FLAGS kwargs['f2py_options'] = ['--quiet'] # numpy.distutils.fcompiler....
def configuration(parent_package='', top_path=None)
Configure all packages that need to be built.
3.568209
3.572069
0.998919
print('---- BUILDING ----') _build.run(self) # build documentation print('---- BUILDING DOCS ----') docdir = os.path.join(self.build_lib, 'pyshtools', 'doc') self.mkpath(docdir) doc_builder = os.path.join(self.build_lib, 'pyshtools', 'make_docs.py') ...
def run(self)
Build the Fortran library, all python extensions and the docs.
3.474157
3.065601
1.133271
print('---- CUSTOM DEVELOP ----') _develop.run(self) # build documentation print('---- BUILDING DOCS ----') docdir = os.path.join(self.setup_path, 'pyshtools', 'doc') self.mkpath(docdir) doc_builder = os.path.join(self.setup_path, 'pyshtools', ...
def run(self)
Build the Fortran library, all python extensions and the docs.
4.631189
4.124975
1.122719
delta_t = epoch - ref_epoch trend = trnd * delta_t periodic_sum = _np.zeros_like(trnd) for period in periodic: for trifunc in periodic[period]: coeffs = periodic[period][trifunc] if trifunc == 'acos': periodic_sum += coeffs * _np.cos(2 * _np.pi / peri...
def _time_variable_part(epoch, ref_epoch, trnd, periodic)
Return sum of the time-variable part of the coefficients The formula is: G(t) = G(t0) + trnd*(t-t0) + asin1*sin(2pi/p1 * (t-t0)) + acos1*cos(2pi/p1 * (t-t0)) + asin2*sin(2pi/p2 * (t-t0)) + acos2*cos(2pi/p2 * (t-t0)) This function computes all terms after G(t0).
2.795751
2.757543
1.013856
# print('\n----',subroutine['name'],'----') #-- use original function from shtools: subroutine['use'] = {'shtools': {'map': {subroutine['name']: subroutine['name']}, 'only': 1}} #-- loop through variables: for varname, varattribs in subroutine['vars'].items(): #-- prefix function retu...
def modify_subroutine(subroutine)
loops through variables of a subroutine and modifies them
6.842419
6.820755
1.003176
width_x = max_width * rel_width width_y = max_width * rel_width / aspect_ratio shtools = { # fonts 'font.size': 10, 'font.family': 'sans-serif', 'font.sans-serif': ['Myriad Pro', 'DejaVu Sans', 'Bitstream Vera Sans', ...
def figstyle(rel_width=0.75, screen_dpi=114, aspect_ratio=4/3, max_width=7.48031)
Set matplotlib parameters for creating publication quality graphics. Usage ----- figstyle([rel_width, screen_dpi, aspect_ratio, max_width]) Parameters ---------- rel_width : float, optional, default = 0.75 The relative width of the plot (from 0 to 1) wih respect to max_width. scree...
2.056563
2.177752
0.944351
if kind.lower() not in ('real', 'complex'): raise ValueError( "Kind must be 'real' or 'complex'. " + "Input value was {:s}." .format(repr(kind)) ) if normalization.lower() not in ('4pi', 'ortho', 'schmidt', 'unnorm'): ...
def from_zeros(self, lmax, kind='real', normalization='4pi', csphase=1)
Initialize class with spherical harmonic coefficients set to zero from degree 0 to lmax. Usage ----- x = SHCoeffs.from_zeros(lmax, [normalization, csphase]) Returns ------- x : SHCoeffs class instance. Parameters ---------- lmax : int ...
2.117582
2.07353
1.021245
if _np.iscomplexobj(coeffs): kind = 'complex' else: kind = 'real' if type(normalization) != str: raise ValueError('normalization must be a string. ' + 'Input type was {:s}' .format(str(type(no...
def from_array(self, coeffs, normalization='4pi', csphase=1, lmax=None, copy=True)
Initialize the class with spherical harmonic coefficients from an input array. Usage ----- x = SHCoeffs.from_array(array, [normalization, csphase, lmax, copy]) Returns ------- x : SHCoeffs class instance. Parameters ---------- array : nd...
2.131299
2.077052
1.026117
if format is 'shtools': with open(filename, mode='w') as file: if header is not None: file.write(header + '\n') for l in range(self.lmax+1): for m in range(l+1): file.write('{:d}, {:d}, {:.16e}, ...
def to_file(self, filename, format='shtools', header=None, **kwargs)
Save raw spherical harmonic coefficients to a file. Usage ----- x.to_file(filename, [format='shtools', header]) x.to_file(filename, [format='npy', **kwargs]) Parameters ---------- filename : str Name of the output file. format : str, optional...
2.373002
2.10193
1.128963
if normalization is None: normalization = self.normalization if csphase is None: csphase = self.csphase if lmax is None: lmax = self.lmax coeffs = _convert(self.coeffs, normalization_in=self.normalization, normalizat...
def to_array(self, normalization=None, csphase=None, lmax=None)
Return spherical harmonic coefficients as a numpy array. Usage ----- coeffs = x.to_array([normalization, csphase, lmax]) Returns ------- coeffs : ndarry, shape (2, lmax+1, lmax+1) numpy ndarray of the spherical harmonic coefficients. Parameters ...
1.897792
2.146807
0.884007
return _spectrum(self.coeffs, normalization=self.normalization, convention=convention, unit=unit, base=base, lmax=lmax)
def spectrum(self, lmax=None, convention='power', unit='per_l', base=10.)
Return the spectrum as a function of spherical harmonic degree. Usage ----- spectrum = x.spectrum([lmax, convention, unit, base]) Returns ------- power : ndarray, shape (lmax+1) 1-D numpy ndarray of the spectrum, where lmax is the maximum spheric...
3.867964
5.565147
0.695034
if self.coeffs[0, 0, 0] == 0: raise ValueError('The volume of the object can not be calculated ' 'when the degree and order 0 term is equal to ' 'zero.') if self.kind == 'complex': raise ValueError('The volume of...
def volume(self, lmax=None)
If the function is the real shape of an object, calculate the volume of the body. Usage ----- volume = x.volume([lmax]) Returns ------- volume : float The volume of the object. Parameters ---------- lmax : int, optional, defa...
3.662796
3.199164
1.144923
if type(convention) != str: raise ValueError('convention must be a string. ' + 'Input type was {:s}' .format(str(type(convention)))) if convention.lower() not in ('x', 'y'): raise ValueError( "con...
def rotate(self, alpha, beta, gamma, degrees=True, convention='y', body=False, dj_matrix=None)
Rotate either the coordinate system used to express the spherical harmonic coefficients or the physical body, and return a new class instance. Usage ----- x_rotated = x.rotate(alpha, beta, gamma, [degrees, convention, body, dj_matrix]) Retur...
2.574278
2.432061
1.058476
if normalization is None: normalization = self.normalization if csphase is None: csphase = self.csphase if lmax is None: lmax = self.lmax if kind is None: kind = self.kind # check argument consistency if type(norma...
def convert(self, normalization=None, csphase=None, lmax=None, kind=None, check=True)
Return a SHCoeffs class instance with a different normalization convention. Usage ----- clm = x.convert([normalization, csphase, lmax, kind, check]) Returns ------- clm : SHCoeffs class instance Parameters ---------- normalization : str,...
1.921493
1.811929
1.060468
if lat is not None and colat is not None: raise ValueError('lat and colat can not both be specified.') if lat is not None and lon is not None: if lmax_calc is None: lmax_calc = self.lmax values = self._expand_coord(lat=lat, lon=lon, degrees=...
def expand(self, grid='DH', lat=None, colat=None, lon=None, degrees=True, zeros=None, lmax=None, lmax_calc=None)
Evaluate the spherical harmonic coefficients either on a global grid or for a list of coordinates. Usage ----- f = x.expand([grid, lmax, lmax_calc, zeros]) g = x.expand(lat=lat, lon=lon, [lmax_calc, degrees]) g = x.expand(colat=colat, lon=lon, [lmax_calc, degrees]) ...
1.859308
1.845897
1.007265
rcomplex_coeffs = _shtools.SHrtoc(self.coeffs, convention=1, switchcs=0) # These coefficients are using real floats, and need to be # converted to complex form. complex_coeffs = _np.zeros((2, self.lmax+1, self.lmax+1), ...
def _make_complex(self)
Convert the real SHCoeffs class to the complex class.
4.270547
3.781253
1.1294