geoist.magmod.tests package

Submodules

geoist.magmod.tests.dipole_coords module

class geoist.magmod.tests.dipole_coords.TestConvertToDipoleCoordinates(methodName='runTest')[源代码]

基类:unittest.case.TestCase

property coordinates
static eval_convert_to_dipole(coords, latitude, longitude)[源代码]
static reference_convert_to_dipole(coords, latitude, longitude)[源代码]
test_convert_to_dipole()[源代码]
test_convert_to_dipole_sanity_check()[源代码]
class geoist.magmod.tests.dipole_coords.TestDipoleRotationMatrix(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval_rotation_matrix(latitude, longitude)[源代码]
static reference_rotation_matrix(latitude, longitude)[源代码]
test_rotation_matrix()[源代码]
class geoist.magmod.tests.dipole_coords.TestVRotDipoleToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.dipole_coords.VRotFromDipoleMixIn

target_coords_type = 2
test_vrot_dipole_to_cartesian_sanity_check()[源代码]
class geoist.magmod.tests.dipole_coords.TestVRotDipoleToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.dipole_coords.VRotFromDipoleToSphericalMixIn

target_coords_type = 1
class geoist.magmod.tests.dipole_coords.TestVRotDipoleToWGS84(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.dipole_coords.VRotFromDipoleToSphericalMixIn

target_coords_type = 0
class geoist.magmod.tests.dipole_coords.VRotFromDipoleMixIn[源代码]

基类:object

property coords
classmethod eval_vrot_from_dipole(vectors, coords, latitude, longitude)[源代码]
classmethod reference_vrot_from_dipole(vectors, coords, latitude, longitude)[源代码]
shape = (37, 37)
target_coords_type = None
test_vrot_dipole2spherical()[源代码]
property vectors
class geoist.magmod.tests.dipole_coords.VRotFromDipoleToSphericalMixIn[源代码]

基类:object

target_coords_type = 1
test_vrot_dipole_to_spherical_sanity_check()[源代码]
geoist.magmod.tests.dipole_coords.random()

random_sample(size=None)

Return random floats in the half-open interval [0.0, 1.0).

Results are from the "continuous uniform" distribution over the stated interval. To sample \(Unif[a, b), b > a\) multiply the output of random_sample by (b-a) and add a:

(b - a) * random_sample() + a
参数

size (int or tuple of ints, optional) -- Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.

返回

out -- Array of random floats of shape size (unless size=None, in which case a single float is returned).

返回类型

float or ndarray of floats

实际案例

>>> np.random.random_sample()
0.47108547995356098
>>> type(np.random.random_sample())
<type 'float'>
>>> np.random.random_sample((5,))
array([ 0.30220482,  0.86820401,  0.1654503 ,  0.11659149,  0.54323428])

Three-by-two array of random numbers from [-5, 0):

>>> 5 * np.random.random_sample((3, 2)) - 5
array([[-3.99149989, -0.52338984],
       [-2.99091858, -0.79479508],
       [-1.23204345, -1.75224494]])

geoist.magmod.tests.magnetic_time module

class geoist.magmod.tests.magnetic_time.TestMjd200ToMagneticUniversalTime(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval(times, lats_ngp, lons_ngp, *args, **kwargs)[源代码]
property ngp_coords
classmethod ref_mjd2000_to_magnetic_universal_time(time, lat_ngp, lon_ngp)[源代码]
classmethod reference(times, lats_ngp, lons_ngp)[源代码]
shape = (25, 25)
static sunpos(time)[源代码]
test_mjd2000_to_magnetic_universal_time()[源代码]
test_mjd2000_to_magnetic_universal_time_fixed_pole()[源代码]
test_mjd2000_to_magnetic_universal_time_with_extra_subsol_coords()[源代码]
property times
geoist.magmod.tests.magnetic_time.uniform(low=0.0, high=1.0, size=None)

Draw samples from a uniform distribution.

Samples are uniformly distributed over the half-open interval [low, high) (includes low, but excludes high). In other words, any value within the given interval is equally likely to be drawn by uniform.

参数
  • low (float or array_like of floats, optional) -- Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0.

  • high (float or array_like of floats) -- Upper boundary of the output interval. All values generated will be less than high. The default value is 1.0.

  • size (int or tuple of ints, optional) -- Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. If size is None (default), a single value is returned if low and high are both scalars. Otherwise, np.broadcast(low, high).size samples are drawn.

返回

out -- Drawn samples from the parameterized uniform distribution.

返回类型

ndarray or scalar

参见

randint

Discrete uniform distribution, yielding integers.

random_integers

Discrete uniform distribution over the closed interval [low, high].

random_sample

Floats uniformly distributed over [0, 1).

random

Alias for random_sample.

rand

Convenience function that accepts dimensions as input, e.g., rand(2,2) would generate a 2-by-2 array of floats, uniformly distributed over [0, 1).

提示

The probability density function of the uniform distribution is

\[p(x) = \frac{1}{b - a}\]

anywhere within the interval [a, b), and zero elsewhere.

When high == low, values of low will be returned. If high < low, the results are officially undefined and may eventually raise an error, i.e. do not rely on this function to behave when passed arguments satisfying that inequality condition.

实际案例

Draw samples from the distribution:

>>> s = np.random.uniform(-1,0,1000)

All values are within the given interval:

>>> np.all(s >= -1)
True
>>> np.all(s < 0)
True

Display the histogram of the samples, along with the probability density function:

>>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 15, density=True)
>>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
>>> plt.show()

geoist.magmod.tests.pymm_convert module

class geoist.magmod.tests.pymm_convert.ConvertTestMixIn[源代码]

基类:object

classmethod cartesian2geodetic(coords)[源代码]
static cartesian2spherical(coords)[源代码]
property coordinates
classmethod eval_convert(coords)[源代码]
static from_geodetic(latitude, elevation)[源代码]
classmethod geodetic2cartesian(coords)[源代码]
classmethod geodetic2spherical(coords)[源代码]
classmethod reference_convert(coords)[源代码]
source_coordinate_system = None
static spherical2cartesian(coords)[源代码]
classmethod spherical2geodetic(coords)[源代码]
target_coordinate_system = None
test_convert()[源代码]
static to_geodetic(z_coord, hypot_xy)[源代码]

Get geodetic coordinates calculated by the Ferrarri's solution.

class geoist.magmod.tests.pymm_convert.SourceCartesian[源代码]

基类:object

property coordinates
source_coordinate_system = 2
class geoist.magmod.tests.pymm_convert.SourceGeodetic[源代码]

基类:object

property coordinates
source_coordinate_system = 0
class geoist.magmod.tests.pymm_convert.SourceSpherical[源代码]

基类:object

property coordinates
source_coordinate_system = 1
class geoist.magmod.tests.pymm_convert.TargetIndetical[源代码]

基类:object

classmethod reference_convert(coords)[源代码]
class geoist.magmod.tests.pymm_convert.TestCartesianToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceCartesian, geoist.magmod.tests.pymm_convert.TargetIndetical, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

target_coordinate_system = 2
class geoist.magmod.tests.pymm_convert.TestCartesianToGeodeticWGS84(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceCartesian, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

classmethod reference_convert(coords)[源代码]
target_coordinate_system = 0
class geoist.magmod.tests.pymm_convert.TestCartesianToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceCartesian, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

classmethod reference_convert(coords)[源代码]
target_coordinate_system = 1
class geoist.magmod.tests.pymm_convert.TestGeodeticWGS84ToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceGeodetic, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

classmethod reference_convert(coords)[源代码]
source_coordinate_system = 0
target_coordinate_system = 2
class geoist.magmod.tests.pymm_convert.TestGeodeticWGS84ToGeodeticWGS84(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceGeodetic, geoist.magmod.tests.pymm_convert.TargetIndetical, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

source_coordinate_system = 0
target_coordinate_system = 0
class geoist.magmod.tests.pymm_convert.TestGeodeticWGS84ToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceGeodetic, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

classmethod reference_convert(coords)[源代码]
source_coordinate_system = 0
target_coordinate_system = 1
class geoist.magmod.tests.pymm_convert.TestSphericalToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceSpherical, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

classmethod reference_convert(coords)[源代码]
target_coordinate_system = 2
class geoist.magmod.tests.pymm_convert.TestSphericalToGeodeticWGS84(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceSpherical, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

classmethod reference_convert(coords)[源代码]
target_coordinate_system = 0
class geoist.magmod.tests.pymm_convert.TestSphericalToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_convert.SourceSpherical, geoist.magmod.tests.pymm_convert.TargetIndetical, geoist.magmod.tests.pymm_convert.ConvertTestMixIn

target_coordinate_system = 1
geoist.magmod.tests.pymm_convert.random() → x in the interval [0, 1).

geoist.magmod.tests.pymm_legendre module

class geoist.magmod.tests.pymm_legendre.TestLegendreFunctions(methodName='runTest')[源代码]

基类:unittest.case.TestCase

classmethod reference(latitude, degree)[源代码]
static schmidt_norm_legendre(x, degree)[源代码]

Evaluate Schmidt semi-normalised Legendre functions and their derivatives.

test_invalid_degree()[源代码]
test_invalid_latitude()[源代码]
test_legendre_functions()[源代码]
test_legendre_functions_zero_degree()[源代码]

geoist.magmod.tests.pymm_lonsincos module

class geoist.magmod.tests.pymm_lonsincos.TestLongitudialSinCosSeries(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static reference(value, degree)[源代码]

Reference implementation.

test_invalid_degree()[源代码]
test_lonsincos_default()[源代码]
test_lonsincos_fast()[源代码]
test_lonsincos_slow()[源代码]
test_lonsincos_zero_degree()[源代码]

geoist.magmod.tests.pymm_relradpow module

class geoist.magmod.tests.pymm_relradpow.TestRadialPowerSeries(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static reference_external(value, degree)[源代码]

Reference implementation - external field.

static reference_internal(value, degree)[源代码]

Reference implementation - internal field.

test_invalid_degree()[源代码]
test_invalid_radius()[源代码]
test_invalid_reference_radius()[源代码]
test_relradpow_default()[源代码]
test_relradpow_external_with_custom_radius()[源代码]
test_relradpow_internal()[源代码]
test_relradpow_internal_with_custom_radius()[源代码]
test_relradpow_zero_degree_external()[源代码]
test_relradpow_zero_degree_internal()[源代码]

geoist.magmod.tests.pymm_sheval module

class geoist.magmod.tests.pymm_sheval.SHTypeExternal[源代码]

基类:object

coef_g = array([ 0. , 30.71175946, 0.74123278, 0.96897933, 1.42731573, 0. ])
coef_h = array([ 0. , 0. , -8.95006273, 0. , 7.06505101, 0. ])
degree = 2
is_internal = False
class geoist.magmod.tests.pymm_sheval.SHTypeInternal[源代码]

基类:object

coef_g = array([ 0.00000000e+00, -2.94572661e+04, -1.52838990e+03, ..., 2.30000000e-03, 3.12000000e-02, 1.03700000e-01])
coef_h = array([ 0.00000000e+00, 0.00000000e+00, 4.83599260e+03, ..., 4.97000000e-02, 1.95900000e-01, 1.22400000e-01])
degree = 70
is_internal = True
class geoist.magmod.tests.pymm_sheval.SourceCartesian[源代码]

基类:object

property coordinates
source_coordinate_system = 2
class geoist.magmod.tests.pymm_sheval.SourceGeodetic[源代码]

基类:object

property coordinates
source_coordinate_system = 0
class geoist.magmod.tests.pymm_sheval.SourceSpherical[源代码]

基类:object

property coordinates
source_coordinate_system = 1
class geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn[源代码]

基类:object

coef_g = None
coef_h = None
degree = None
classmethod eval_sheval(coords, mode)[源代码]
classmethod get_series(degree, latitude, longitude, radius)[源代码]
is_internal = True
options = {}
classmethod reference_sheval(coords)[源代码]
scale_gradient = [1.0, 1.0, 1.0]
scale_potential = 1.0
source_coordinate_system = None
target_coordinate_system = None
test_sheval_gradient()[源代码]
test_sheval_potential()[源代码]
test_sheval_potential_and_gradient()[源代码]
class geoist.magmod.tests.pymm_sheval.TestSHEvalCart2CartScaled(methodName='runTest')[源代码]

基类:geoist.magmod.tests.pymm_sheval.TestSHEvalCartesian2CartesianInternal

options = {'scale_gradient': [0.5, 1.0, -1.0], 'scale_potential': 2.0}
scale_gradient = [0.5, 1.0, -1.0]
scale_potential = 2.0
class geoist.magmod.tests.pymm_sheval.TestSHEvalCartesian2CartesianExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceCartesian, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.pymm_sheval.TestSHEvalCartesian2CartesianInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceCartesian, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.pymm_sheval.TestSHEvalCartesian2SphericalExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceCartesian, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.pymm_sheval.TestSHEvalCartesian2SphericalInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceCartesian, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.pymm_sheval.TestSHEvalCartesian2WGS84External(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceCartesian, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.pymm_sheval.TestSHEvalCartesian2WGS84Internal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceCartesian, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.pymm_sheval.TestSHEvalSph2SphScaled(methodName='runTest')[源代码]

基类:geoist.magmod.tests.pymm_sheval.TestSHEvalSpherical2SphericalInternal

options = {'scale_gradient': -1.0}
scale_gradient = [-1.0, -1.0, -1.0]
class geoist.magmod.tests.pymm_sheval.TestSHEvalSpherical2CartesianExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceSpherical, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.pymm_sheval.TestSHEvalSpherical2CartesianInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceSpherical, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.pymm_sheval.TestSHEvalSpherical2SphericalExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceSpherical, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.pymm_sheval.TestSHEvalSpherical2SphericalInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceSpherical, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.pymm_sheval.TestSHEvalSpherical2WGS84External(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceSpherical, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.pymm_sheval.TestSHEvalSpherical2WGS84Internal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceSpherical, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.pymm_sheval.TestSHEvalWGS842CartesianExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceGeodetic, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.pymm_sheval.TestSHEvalWGS842CartesianInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceGeodetic, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.pymm_sheval.TestSHEvalWGS842SphericalExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceGeodetic, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.pymm_sheval.TestSHEvalWGS842SphericalInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceGeodetic, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.pymm_sheval.TestSHEvalWGS842WGS84External(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceGeodetic, geoist.magmod.tests.pymm_sheval.SHTypeExternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.pymm_sheval.TestSHEvalWGS842WGS84Internal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sheval.SourceGeodetic, geoist.magmod.tests.pymm_sheval.SHTypeInternal, geoist.magmod.tests.pymm_sheval.SphericalHarmonicsMixIn

target_coordinate_system = 0
geoist.magmod.tests.pymm_sheval.random() → x in the interval [0, 1).

geoist.magmod.tests.pymm_sphargrd module

class geoist.magmod.tests.pymm_sphargrd.SphericalHarmonicsGradientTestMixIn[源代码]

基类:magmod.tests.pymm_spharpot.SphericalHarmonicsCommonMixIn

classmethod eval_gradient(degree, coef_g, coef_h, latitude, longitude, radius)[源代码]
classmethod reference_gradient(degree, coef_g, coef_h, latitude, longitude, radius)[源代码]
test_coefficients()[源代码]
test_gradient()[源代码]
test_gradient_compared_with_finite_differences()[源代码]
class geoist.magmod.tests.pymm_sphargrd.TestSphericalHarmonicsGradientExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sphargrd.SphericalHarmonicsGradientTestMixIn

coef_g = array([ 0. , 30.71175946, 0.74123278, 0.96897933, 1.42731573, 0. ])
coef_h = array([ 0. , 0. , -8.95006273, 0. , 7.06505101, 0. ])
degree = 2
is_internal = False
class geoist.magmod.tests.pymm_sphargrd.TestSphericalHarmonicsGradientInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_sphargrd.SphericalHarmonicsGradientTestMixIn

coef_g = array([ 0.00000000e+00, -2.94572661e+04, -1.52838990e+03, ..., 2.30000000e-03, 3.12000000e-02, 1.03700000e-01])
coef_h = array([ 0.00000000e+00, 0.00000000e+00, 4.83599260e+03, ..., 4.97000000e-02, 1.95900000e-01, 1.22400000e-01])
degree = 70
is_internal = True
geoist.magmod.tests.pymm_sphargrd.random() → x in the interval [0, 1).

geoist.magmod.tests.pymm_spharpot module

class geoist.magmod.tests.pymm_spharpot.SphericalHarmonicsCommonMixIn[源代码]

基类:object

coef_g = None
coef_h = None
degree = None
classmethod eval_potential(degree, coef_g, coef_h, latitude, longitude, radius)[源代码]
classmethod get_series(degree, latitude, longitude, radius)[源代码]
is_internal = True
classmethod reference_potential(degree, coef_g, coef_h, latitude, longitude, radius)[源代码]
class geoist.magmod.tests.pymm_spharpot.SphericalHarmonicsPotentialTestMixIn[源代码]

基类:geoist.magmod.tests.pymm_spharpot.SphericalHarmonicsCommonMixIn

test_coefficients()[源代码]
test_potential()[源代码]
class geoist.magmod.tests.pymm_spharpot.TestSphericalHarmonicsPotentialExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_spharpot.SphericalHarmonicsPotentialTestMixIn

coef_g = array([ 0. , 30.71175946, 0.74123278, 0.96897933, 1.42731573, 0. ])
coef_h = array([ 0. , 0. , -8.95006273, 0. , 7.06505101, 0. ])
degree = 2
is_internal = False
class geoist.magmod.tests.pymm_spharpot.TestSphericalHarmonicsPotentialInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_spharpot.SphericalHarmonicsPotentialTestMixIn

coef_g = array([ 0.00000000e+00, -2.94572661e+04, -1.52838990e+03, ..., 2.30000000e-03, 3.12000000e-02, 1.03700000e-01])
coef_h = array([ 0.00000000e+00, 0.00000000e+00, 4.83599260e+03, ..., 4.97000000e-02, 1.95900000e-01, 1.22400000e-01])
degree = 70
is_internal = True
geoist.magmod.tests.pymm_spharpot.random() → x in the interval [0, 1).

geoist.magmod.tests.pymm_vrot module

class geoist.magmod.tests.pymm_vrot.TestVectorRotationCaresianToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_vrot.VectorRotationMixIn

static eval_vrot(vectors, coords)[源代码]
classmethod reference_vrot(vectors, coords)[源代码]
class geoist.magmod.tests.pymm_vrot.TestVectorRotationGeodeticToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_vrot.VectorRotationMixIn

static difflat_geodetic_to_spherical(latitude)[源代码]
classmethod eval_vrot(vectors, coords)[源代码]
classmethod reference_vrot(vectors, coords)[源代码]
test_vrot_sanity_check()[源代码]
class geoist.magmod.tests.pymm_vrot.TestVectorRotationSphericalToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_vrot.VectorRotationMixIn

static eval_vrot(vectors, coords)[源代码]
classmethod reference_vrot(vectors, coords)[源代码]
test_vrot_sanity_check()[源代码]
class geoist.magmod.tests.pymm_vrot.TestVectorRotationSphericalToGeodetic(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.pymm_vrot.VectorRotationMixIn

static difflat_spherical_to_geodetic(latitude)[源代码]
classmethod eval_vrot(vectors, coords)[源代码]
classmethod reference_vrot(vectors, coords)[源代码]
test_vrot_sanity_check()[源代码]
class geoist.magmod.tests.pymm_vrot.VectorRotationMixIn[源代码]

基类:object

property coords
static rotate2d(x_coords, y_coords, angles)[源代码]
shape = (19, 19)
test_vrot()[源代码]
test_vrot_sanity_check()[源代码]
property vectors
geoist.magmod.tests.pymm_vrot.random()

random_sample(size=None)

Return random floats in the half-open interval [0.0, 1.0).

Results are from the "continuous uniform" distribution over the stated interval. To sample \(Unif[a, b), b > a\) multiply the output of random_sample by (b-a) and add a:

(b - a) * random_sample() + a
参数

size (int or tuple of ints, optional) -- Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.

返回

out -- Array of random floats of shape size (unless size=None, in which case a single float is returned).

返回类型

float or ndarray of floats

实际案例

>>> np.random.random_sample()
0.47108547995356098
>>> type(np.random.random_sample())
<type 'float'>
>>> np.random.random_sample((5,))
array([ 0.30220482,  0.86820401,  0.1654503 ,  0.11659149,  0.54323428])

Three-by-two array of random numbers from [-5, 0):

>>> 5 * np.random.random_sample((3, 2)) - 5
array([[-3.99149989, -0.52338984],
       [-2.99091858, -0.79479508],
       [-1.23204345, -1.75224494]])

geoist.magmod.tests.pytimeconv module

class geoist.magmod.tests.pytimeconv.TestDecimalYearToMjd2000(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval(value)[源代码]
static reference(value)[源代码]
test_decimal_year_to_mjd2000_far_range()[源代码]
test_decimal_year_to_mjd2000_near_range()[源代码]
test_decimal_year_to_mjd2000_sanity_check()[源代码]
test_decimal_year_to_mjd2000_special_values()[源代码]
class geoist.magmod.tests.pytimeconv.TestMjd2000ToDecimalYear(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval(value)[源代码]
static reference(value)[源代码]
test_mjd2000_to_decimal_year_far_range()[源代码]
test_mjd2000_to_decimal_year_near_range()[源代码]
test_mjd2000_to_decimal_year_sanity_check()[源代码]
test_mjd2000_to_decimal_year_special_values()[源代码]
class geoist.magmod.tests.pytimeconv.TestMjd2000ToYearFraction(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval(value)[源代码]
static reference(value)[源代码]
test_mjd2000_to_year_fraction_far_range()[源代码]
test_mjd2000_to_year_fraction_near_range()[源代码]
test_mjd2000_to_year_fraction_sanity_check()[源代码]
geoist.magmod.tests.pytimeconv.day2k_to_year(day2k)[源代码]

Convert integer day number since 2000-01-01 to date as (year, month, day) tuple.

geoist.magmod.tests.pytimeconv.days_per_year(year)[源代码]

Return integer number of days in the given year.

geoist.magmod.tests.pytimeconv.is_leap_year(year)[源代码]

Return boolean flag indicating whether the given year is a leap year or not.

geoist.magmod.tests.pytimeconv.uniform(low=0.0, high=1.0, size=None)

Draw samples from a uniform distribution.

Samples are uniformly distributed over the half-open interval [low, high) (includes low, but excludes high). In other words, any value within the given interval is equally likely to be drawn by uniform.

参数
  • low (float or array_like of floats, optional) -- Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0.

  • high (float or array_like of floats) -- Upper boundary of the output interval. All values generated will be less than high. The default value is 1.0.

  • size (int or tuple of ints, optional) -- Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. If size is None (default), a single value is returned if low and high are both scalars. Otherwise, np.broadcast(low, high).size samples are drawn.

返回

out -- Drawn samples from the parameterized uniform distribution.

返回类型

ndarray or scalar

参见

randint

Discrete uniform distribution, yielding integers.

random_integers

Discrete uniform distribution over the closed interval [low, high].

random_sample

Floats uniformly distributed over [0, 1).

random

Alias for random_sample.

rand

Convenience function that accepts dimensions as input, e.g., rand(2,2) would generate a 2-by-2 array of floats, uniformly distributed over [0, 1).

提示

The probability density function of the uniform distribution is

\[p(x) = \frac{1}{b - a}\]

anywhere within the interval [a, b), and zero elsewhere.

When high == low, values of low will be returned. If high < low, the results are officially undefined and may eventually raise an error, i.e. do not rely on this function to behave when passed arguments satisfying that inequality condition.

实际案例

Draw samples from the distribution:

>>> s = np.random.uniform(-1,0,1000)

All values are within the given interval:

>>> np.all(s >= -1)
True
>>> np.all(s < 0)
True

Display the histogram of the samples, along with the probability density function:

>>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 15, density=True)
>>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
>>> plt.show()
geoist.magmod.tests.pytimeconv.year_to_day2k(year)[源代码]

Get the date to number of days since 2000-01-01 of the year start.

geoist.magmod.tests.quasi_dipole_coordinates module

geoist.magmod.tests.sheval_dipole module

class geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn[源代码]

基类:object

coef_g = None
coef_h = None
degree = None
classmethod eval_sheval(coords, mode)[源代码]
classmethod get_series(degree, latitude, longitude, radius)[源代码]
is_internal = True
options = {}
classmethod reference_sheval(coords)[源代码]
scale_gradient = [1.0, 1.0, 1.0]
scale_potential = 1.0
source_coordinate_system = None
target_coordinate_system = None
test_sheval_gradient()[源代码]
test_sheval_potential()[源代码]
test_sheval_potential_and_gradient()[源代码]
class geoist.magmod.tests.sheval_dipole.SHTypeExternal[源代码]

基类:object

coef_g = array([ 0. , 30.71175946, 0.74123278, 0.96897933, 1.42731573, 0. ])
coef_h = array([ 0. , 0. , -8.95006273, 0. , 7.06505101, 0. ])
degree = 2
is_internal = False
lat_ngp = 80.08
lon_ngp = -72.22
class geoist.magmod.tests.sheval_dipole.SHTypeInternal[源代码]

基类:object

coef_g = array([ 0. , 6.3766112 , -0.295167 , -0.66651368, 1.11417107, -0.4136859 , 2.26439 , 0.93146408, 0.38256984, -0.23358711])
coef_h = array([ 0. , 0. , -3.50699346, 0. , 2.65809245, 0.63893495, 0. , 0.47370118, 0.82266802, -0.01490471])
degree = 3
is_internal = True
lat_ngp = 80.08
lon_ngp = -72.22
class geoist.magmod.tests.sheval_dipole.SourceCartesian[源代码]

基类:object

property coordinates
source_coordinate_system = 2
class geoist.magmod.tests.sheval_dipole.SourceGeodetic[源代码]

基类:object

property coordinates
source_coordinate_system = 0
class geoist.magmod.tests.sheval_dipole.SourceSpherical[源代码]

基类:object

property coordinates
source_coordinate_system = 1
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCart2CartScaled(methodName='runTest')[源代码]

基类:geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCartesian2CartesianInternal

options = {'scale_gradient': [0.5, 1.0, -1.0], 'scale_potential': 2.0}
scale_gradient = [0.5, 1.0, -1.0]
scale_potential = 2.0
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCartesian2CartesianExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceCartesian, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCartesian2CartesianInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceCartesian, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCartesian2SphericalExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceCartesian, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCartesian2SphericalInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceCartesian, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCartesian2WGS84External(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceCartesian, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalCartesian2WGS84Internal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceCartesian, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSph2SphScaled(methodName='runTest')[源代码]

基类:geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSpherical2SphericalInternal

options = {'scale_gradient': -1.0}
scale_gradient = [-1.0, -1.0, -1.0]
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSpherical2CartesianExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceSpherical, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSpherical2CartesianInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceSpherical, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSpherical2SphericalExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceSpherical, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSpherical2SphericalInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceSpherical, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSpherical2WGS84External(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceSpherical, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalSpherical2WGS84Internal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceSpherical, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalWGS842CartesianExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceGeodetic, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalWGS842CartesianInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceGeodetic, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 2
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalWGS842SphericalExternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceGeodetic, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalWGS842SphericalInternal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceGeodetic, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 1
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalWGS842WGS84External(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceGeodetic, geoist.magmod.tests.sheval_dipole.SHTypeExternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 0
class geoist.magmod.tests.sheval_dipole.TestDipoleSHEvalWGS842WGS84Internal(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.sheval_dipole.SourceGeodetic, geoist.magmod.tests.sheval_dipole.SHTypeInternal, geoist.magmod.tests.sheval_dipole.DipoleSphericalHarmonicsMixIn

target_coordinate_system = 0
geoist.magmod.tests.sheval_dipole.random() → x in the interval [0, 1).

geoist.magmod.tests.solar_position module

geoist.magmod.tests.time_util module

class geoist.magmod.tests.time_util.TestDecimalYearToMjd2000Simple(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval(value)[源代码]
static reference(value)[源代码]
test_decimal_year_to_mjd2000_far_range()[源代码]
test_decimal_year_to_mjd2000_near_range()[源代码]
test_decimal_year_to_mjd2000_sanity_check()[源代码]
test_decimal_year_to_mjd2000_special_values()[源代码]
class geoist.magmod.tests.time_util.TestMjd2000ToDecimalYearSimple(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval(value)[源代码]
static reference(value)[源代码]
test_mjd2000_to_decimal_year_far_range()[源代码]
test_mjd2000_to_decimal_year_near_range()[源代码]
test_mjd2000_to_decimal_year_sanity_check()[源代码]
test_mjd2000_to_decimal_year_special_values()[源代码]
class geoist.magmod.tests.time_util.TestMjd2000ToYearFractionSimple(methodName='runTest')[源代码]

基类:unittest.case.TestCase

static eval(value)[源代码]
static reference(value)[源代码]
test_mjd2000_to_year_fraction_far_range()[源代码]
test_mjd2000_to_year_fraction_near_range()[源代码]
test_mjd2000_to_year_fraction_sanity_check()[源代码]
geoist.magmod.tests.time_util.uniform(low=0.0, high=1.0, size=None)

Draw samples from a uniform distribution.

Samples are uniformly distributed over the half-open interval [low, high) (includes low, but excludes high). In other words, any value within the given interval is equally likely to be drawn by uniform.

参数
  • low (float or array_like of floats, optional) -- Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0.

  • high (float or array_like of floats) -- Upper boundary of the output interval. All values generated will be less than high. The default value is 1.0.

  • size (int or tuple of ints, optional) -- Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. If size is None (default), a single value is returned if low and high are both scalars. Otherwise, np.broadcast(low, high).size samples are drawn.

返回

out -- Drawn samples from the parameterized uniform distribution.

返回类型

ndarray or scalar

参见

randint

Discrete uniform distribution, yielding integers.

random_integers

Discrete uniform distribution over the closed interval [low, high].

random_sample

Floats uniformly distributed over [0, 1).

random

Alias for random_sample.

rand

Convenience function that accepts dimensions as input, e.g., rand(2,2) would generate a 2-by-2 array of floats, uniformly distributed over [0, 1).

提示

The probability density function of the uniform distribution is

\[p(x) = \frac{1}{b - a}\]

anywhere within the interval [a, b), and zero elsewhere.

When high == low, values of low will be returned. If high < low, the results are officially undefined and may eventually raise an error, i.e. do not rely on this function to behave when passed arguments satisfying that inequality condition.

实际案例

Draw samples from the distribution:

>>> s = np.random.uniform(-1,0,1000)

All values are within the given interval:

>>> np.all(s >= -1)
True
>>> np.all(s < 0)
True

Display the histogram of the samples, along with the probability density function:

>>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 15, density=True)
>>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
>>> plt.show()

geoist.magmod.tests.util module

class geoist.magmod.tests.util.FunctionTestMixIn[源代码]

基类:object

Simple function test mix in.

static eval(input_)[源代码]
test_accepted()[源代码]
test_rejected()[源代码]
class geoist.magmod.tests.util.TestDatetimeToDecimalYear(methodName='runTest')[源代码]

基类:geoist.magmod.tests.util.FunctionTestMixIn, unittest.case.TestCase

ACCEPTED = [(datetime.datetime(2001, 1, 12, 0, 0), 2001.0301369863014), (datetime.datetime(2012, 8, 31, 0, 0), 2012.6639344262296), (datetime.datetime(2014, 8, 31, 0, 0), 2014.66301369863), (datetime.datetime(2024, 12, 31, 23, 59, 59, 999), 2024.9999999684085)]
NAME = 'datetime_to_decimal_year'
REJECTED = [(None, <class 'TypeError'>), (datetime.date(2001, 1, 12), <class 'TypeError'>)]
static eval(input_)[源代码]
class geoist.magmod.tests.util.TestVincdecnorm(methodName='runTest')[源代码]

基类:geoist.magmod.tests.util.FunctionTestMixIn, unittest.case.TestCase

ACCEPTED = [([1, 0, 0], (0, 0, 1)), ((0, 1, 0), (0, 90, 1)), (array([0, 0, 1]), (-90, 0, 1)), (array([[-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]]), (array([ 0, 0, 90]), array([180, -90, 0]), array([1, 1, 1]))), (array([[[ 0.82544278, 0.23376316, 0.33205357], [ 0.06208131, 0.63504005, -0.78131731], [ 0.86222978, 0.65663201, 0.65170281], [-0.16437946, 0.40473597, -0.35760514]], [[-0.48720026, 0.18952629, -0.8906141 ], [-0.06893185, -0.61986417, -0.79941557], [ 0.12094749, 0.33802827, 0.64999703], [-0.36555326, -0.1363087 , 0.50091617]], [[-0.25049911, 0.14976648, 0.80102138], [-0.96197621, 0.2603063 , 0.17388555], [-0.94671758, -0.82102239, 0.62979664], [-0.99625197, -0.87799085, 0.95585576]], [[ 0.04618681, -0.84110911, 0.97818344], [-0.01086467, 0.21928006, -0.96179247], [ 0.7898758 , -0.86362723, 0.10181061], [ 0.14741587, -0.19785671, -0.06904178]]]), (array([[-21.15901257, 50.76300438, -31.01921101, 39.30418462], [ 59.58823632, 52.03948549, -61.08670218, -52.0866531 ], [-69.98055814, -9.89753007, -26.6830097 , -35.74676721], [-49.26615694, 77.14137388, -4.97166886, 15.63269911]]), array([[ 15.81197833, 84.41652502, 37.29112409, 112.10403758], [ 158.74341437, -96.34549228, 70.3126441 , -159.55035541], [ 149.12596586, 164.85863574, -139.06717246, -138.61046712], [ -86.85694253, 92.83651461, -47.55387908, -53.31153904]]), array([[ 0.91992422, 1.00875502, 1.26464317, 0.56454694], [ 1.03270411, 1.01392724, 0.74255474, 0.63492224], [ 0.85253449, 1.01162927, 1.40249626, 1.63616813], [ 1.29090689, 0.98653258, 1.17478559, 0.25621375]])))]
REJECTED = [(None, <class 'ValueError'>), (1.0, <class 'ValueError'>), ([1, 2], <class 'ValueError'>), ([1, 2, 3, 4], <class 'ValueError'>), (array([[1, 2]]), <class 'ValueError'>), (array([[1, 2, 3, 4]]), <class 'ValueError'>)]
static eval(input_)[源代码]
class geoist.magmod.tests.util.TestVnorm(methodName='runTest')[源代码]

基类:geoist.magmod.tests.util.FunctionTestMixIn, unittest.case.TestCase

ACCEPTED = [(1.0, 1.0), ([4, 3], 5), ([0, 0, 0], 0), (array([1, 0, 0]), 1), (array([ 0., 1., 0.]), 1), (array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]), array([ 1., 1., 1.])), (array([[[ 0.82544278, 0.23376316, 0.33205357], [ 0.06208131, 0.63504005, -0.78131731], [ 0.86222978, 0.65663201, 0.65170281], [-0.16437946, 0.40473597, -0.35760514]], [[-0.48720026, 0.18952629, -0.8906141 ], [-0.06893185, -0.61986417, -0.79941557], [ 0.12094749, 0.33802827, 0.64999703], [-0.36555326, -0.1363087 , 0.50091617]], [[-0.25049911, 0.14976648, 0.80102138], [-0.96197621, 0.2603063 , 0.17388555], [-0.94671758, -0.82102239, 0.62979664], [-0.99625197, -0.87799085, 0.95585576]], [[ 0.04618681, -0.84110911, 0.97818344], [-0.01086467, 0.21928006, -0.96179247], [ 0.7898758 , -0.86362723, 0.10181061], [ 0.14741587, -0.19785671, -0.06904178]]]), array([[ 0.91992422, 1.00875502, 1.26464317, 0.56454694], [ 1.03270411, 1.01392724, 0.74255474, 0.63492224], [ 0.85253449, 1.01162927, 1.40249626, 1.63616813], [ 1.29090689, 0.98653258, 1.17478559, 0.25621375]]))]
NAME = 'vnorm'
REJECTED = [(None, <class 'TypeError'>)]
static eval(input_)[源代码]

geoist.magmod.tests.util_vrotate module

class geoist.magmod.tests.util_vrotate.TestVectorRotateCartesianToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationIdentityMixIn

source_coordinate_system = 2
target_coordinate_system = 2
class geoist.magmod.tests.util_vrotate.TestVectorRotateCartesianToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationCartesianToSphericalMixIn

source_coordinate_system = 2
target_coordinate_system = 1
class geoist.magmod.tests.util_vrotate.TestVectorRotateCartesianToWGS84(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationCartesianToSphericalMixIn

source_coordinate_system = 2
target_coordinate_system = 0
class geoist.magmod.tests.util_vrotate.TestVectorRotateSphericalToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationSphericalToCartesianMixIn

source_coordinate_system = 1
target_coordinate_system = 2
class geoist.magmod.tests.util_vrotate.TestVectorRotateSphericalToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationIdentityMixIn

source_coordinate_system = 1
target_coordinate_system = 1
class geoist.magmod.tests.util_vrotate.TestVectorRotateSphericalToWGS84(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationGeodeticToSphericalMixIn

source_coordinate_system = 1
target_coordinate_system = 0
class geoist.magmod.tests.util_vrotate.TestVectorRotateWGS84ToCartesian(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationSphericalToCartesianMixIn

source_coordinate_system = 0
target_coordinate_system = 2
class geoist.magmod.tests.util_vrotate.TestVectorRotateWGS84ToSpherical(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationGeodeticToSphericalMixIn

source_coordinate_system = 0
target_coordinate_system = 1
class geoist.magmod.tests.util_vrotate.TestVectorRotateWGS84ToWGS84(methodName='runTest')[源代码]

基类:unittest.case.TestCase, geoist.magmod.tests.util_vrotate.VectorRotationIdentityMixIn

source_coordinate_system = 0
target_coordinate_system = 0
class geoist.magmod.tests.util_vrotate.VectorRotationCartesianToSphericalMixIn[源代码]

基类:geoist.magmod.tests.util_vrotate.VectorRotationMixIn

classmethod get_input_and_output_coordinates(coords)[源代码]
classmethod reference_vrotate(vectors, coords)[源代码]
class geoist.magmod.tests.util_vrotate.VectorRotationGeodeticToSphericalMixIn[源代码]

基类:geoist.magmod.tests.util_vrotate.VectorRotationSphericalToGeodeticMixIn

classmethod get_input_and_output_coordinates(coords)[源代码]
class geoist.magmod.tests.util_vrotate.VectorRotationIdentityMixIn[源代码]

基类:geoist.magmod.tests.util_vrotate.VectorRotationMixIn

classmethod get_input_and_output_coordinates(coords)[源代码]
classmethod reference_vrotate(vectors, coords)[源代码]
class geoist.magmod.tests.util_vrotate.VectorRotationMixIn[源代码]

基类:object

property coords
classmethod eval_vrotate(vectors, coords)[源代码]
classmethod get_input_and_output_coordinates(coords)[源代码]
classmethod reference_vrotate(vectors, coords)[源代码]
shape = (19, 19)
source_coordinate_system = None
target_coordinate_system = None
test_vrotate()[源代码]
property vectors
class geoist.magmod.tests.util_vrotate.VectorRotationSphericalToCartesianMixIn[源代码]

基类:geoist.magmod.tests.util_vrotate.VectorRotationMixIn

classmethod get_input_and_output_coordinates(coords)[源代码]
classmethod reference_vrotate(vectors, coords)[源代码]
class geoist.magmod.tests.util_vrotate.VectorRotationSphericalToGeodeticMixIn[源代码]

基类:geoist.magmod.tests.util_vrotate.VectorRotationMixIn

classmethod get_input_and_output_coordinates(coords)[源代码]
classmethod reference_vrotate(vectors, coords)[源代码]
geoist.magmod.tests.util_vrotate.random()

random_sample(size=None)

Return random floats in the half-open interval [0.0, 1.0).

Results are from the "continuous uniform" distribution over the stated interval. To sample \(Unif[a, b), b > a\) multiply the output of random_sample by (b-a) and add a:

(b - a) * random_sample() + a
参数

size (int or tuple of ints, optional) -- Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.

返回

out -- Array of random floats of shape size (unless size=None, in which case a single float is returned).

返回类型

float or ndarray of floats

实际案例

>>> np.random.random_sample()
0.47108547995356098
>>> type(np.random.random_sample())
<type 'float'>
>>> np.random.random_sample((5,))
array([ 0.30220482,  0.86820401,  0.1654503 ,  0.11659149,  0.54323428])

Three-by-two array of random numbers from [-5, 0):

>>> 5 * np.random.random_sample((3, 2)) - 5
array([[-3.99149989, -0.52338984],
       [-2.99091858, -0.79479508],
       [-1.23204345, -1.75224494]])

Module contents