Commit 28b8ec43 authored by Stefan Mauerberger's avatar Stefan Mauerberger
Browse files

Introduced a function that returns the dict of built-in models

parent 0c774729
......@@ -26,7 +26,10 @@ __all__ = ['master_curve', 'dipole_series', 'file2splines', 'field',
'models', 'coefficients', 'utils']
from .pymagglobal import master_curve, dipole_series, file2splines, \
field, coefficients, models
field, coefficients, built_in_models
from . import utils
models = built_in_models()
'''Built-in models'''
__version__ = '0.0.2'
......@@ -30,17 +30,19 @@ import os
import numpy as np
from scipy.interpolate import BSpline
# XXX pyfield.dspharm_CLR_NED were less cryptic than CRUSpline as kernel
from pyfield import CRUSpline as Kernel, REARTH, i2lm_l, i2lm_m, lmax2N
from .utils import nez2dif
# generate a dictionary of models from models the models folder
here = os.path.abspath(os.path.dirname(__file__))
datdir = os.path.join(here, 'dat/')
models = {}
for it in os.listdir(datdir):
if os.path.isfile(os.path.join(datdir, it)) and not 'README' in it:
models[it] = os.path.join(datdir, it)
def built_in_models() -> dict:
'''Returns a dictionary of models for all model-files in the dat-folder.'''
here = os.path.abspath(os.path.dirname(__file__))
datdir = os.path.join(here, 'dat/')
models = {}
for it in os.listdir(datdir):
if os.path.isfile(os.path.join(datdir, it)) and not 'README' in it:
models[it] = os.path.join(datdir, it)
def master_curve(times, loc, splines, ser_type='dif'):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment