Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sec23
korte
pymagglobal
Commits
2e4e9415
Commit
2e4e9415
authored
Jul 13, 2021
by
Maximilian Schanner
Browse files
Change ser_type kwarg.
parent
0cd2a1df
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pymagglobal/_commands.py
View file @
2e4e9415
...
...
@@ -142,7 +142,7 @@ def master_curve(args):
# create a master curve using the core function, check is performed
# in args2times
curves
=
core
.
master_curve
(
times
,
(
args
.
lat
,
args
.
lon
),
args
.
model
,
ser
_type
=
args
.
type
,
check
=
False
)
field
_type
=
args
.
type
,
check
=
False
)
# output formats for dif and nez components
fmts
=
{
'dif'
:
(
'%.2f'
,
'%2.6f'
,
'%2.6f'
,
'%1.7e'
),
'nez'
:
(
'%.2f'
,
'%1.7e'
,
'%1.7e'
,
'%1.7e'
)}
...
...
pymagglobal/core.py
View file @
2e4e9415
...
...
@@ -167,7 +167,7 @@ class Model(object):
f
'degree
{
self
.
l_max
}
. Input
{
max
(
degrees
)
}
is '
f
'invalid.'
)
if
len
(
degrees
)
!=
len
(
orders
):
raise
ValueError
(
f
'Different number of degrees and orders given!'
)
raise
ValueError
(
'Different number of degrees and orders given!'
)
inds
=
np
.
empty_like
(
degrees
,
dtype
=
int
)
for
it
,
(
ell
,
m
)
in
enumerate
(
zip
(
degrees
,
orders
)):
if
ell
<
abs
(
m
):
...
...
@@ -176,7 +176,7 @@ class Model(object):
return
inds
def
master_curve
(
times
,
loc
,
splines
,
cov_splines
=
None
,
ser
_type
=
'dif'
,
def
master_curve
(
times
,
loc
,
splines
,
cov_splines
=
None
,
field
_type
=
'dif'
,
check
=
True
):
'''Create master curves from a splines object.
...
...
@@ -188,7 +188,7 @@ def master_curve(times, loc, splines, cov_splines=None, ser_type='dif',
lat, lon tuple of the location at which to create the master curve.
splines : scipy.interpolate.BSpline or Model
An instance of Model or splines specifying the model.
ser
_type : {'dif', 'nez'}
field
_type : {'dif', 'nez'}
The type of the master curves. May be either 'dif' (default) for
declination, inclination and intensity or 'nez' for north, east, down.
cov_splines : scipy.interpolate.BSpline, optional
...
...
@@ -202,19 +202,19 @@ def master_curve(times, loc, splines, cov_splines=None, ser_type='dif',
-------
ndarray
The first component master curve. Either declination or north,
depending on the
ser
_type kwarg. If cov_splines is given, a tuple
depending on the
field
_type kwarg. If cov_splines is given, a tuple
containing the component and the standard deviation is returned.
ndarray
The second component master curve. Either inclination or east,
depending on the
ser
_type kwarg. If cov_splines is given, a tuple
depending on the
field
_type kwarg. If cov_splines is given, a tuple
containing the component and the standard deviation is returned.
ndarray
The third component master curve. Either intensity or down,
depending on the
ser
_type kwarg. If cov_splines is given, a tuple
depending on the
field
_type kwarg. If cov_splines is given, a tuple
containing the component and the standard deviation is returned.
'''
if
ser
_type
not
in
[
'nez'
,
'dif'
]:
raise
ValueError
(
f
"
{
ser
_type
}
is not a valid series type. 'dif' and "
if
field
_type
not
in
[
'nez'
,
'dif'
]:
raise
ValueError
(
f
"
{
field
_type
}
is not a valid series type. 'dif' and "
f
"'nez' are supported."
)
if
isinstance
(
splines
,
Model
):
if
check
:
...
...
@@ -235,7 +235,7 @@ def master_curve(times, loc, splines, cov_splines=None, ser_type='dif',
z_mst
[
3
]
=
times
# the master curves are just field values at a constant location
mst_cv
=
field
(
z_mst
,
splines
,
cov_splines
=
cov_splines
,
field_type
=
ser
_type
)
field_type
=
field
_type
)
if
cov_splines
is
None
:
return
mst_cv
[
0
],
mst_cv
[
1
],
mst_cv
[
2
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment