Skip to content

Commit aabfe75

Browse files
author
NGC
authored
adding new halo config in basis_utils.py
1 parent ddaa993 commit aabfe75

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

EXPtools/basis_builder/basis_utils.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from scipy.linalg import norm
44
from EXPtools.basis_builder import makemodel
55

6-
def make_config(basis_id, numr, rmin, rmax, lmax, nmax, scale,
6+
def old_make_config(basis_id, numr, rmin, rmax, lmax, nmax, scale,
77
modelname='', cachename='.slgrid_sph_cache'):
88
"""
99
Creates a configuration file required to build a basis model.
@@ -38,6 +38,42 @@ def make_config(basis_id, numr, rmin, rmax, lmax, nmax, scale,
3838
config += ' cachename: {}\n'.format(cachename)
3939
return config
4040

41+
42+
def make_halo_config(basis_id, numr, rmin, rmax, lmax, nmax, rmapping,
43+
modelname, cachename):
44+
"""
45+
Creates a configuration file required to build a basis model.
46+
47+
Args:
48+
basis_id (str): The identity of the basis model.
49+
numr (int): The number of radial grid points.
50+
rmin (float): The minimum radius value.
51+
rmax (float): The maximum radius value.
52+
lmax (int): The maximum l value of the basis.
53+
nmax (int): The maximum n value of the basis.
54+
scale (float): Scaling factor for the basis.
55+
modelname (str, optional): Name of the model. Default is an empty string.
56+
cachename (str, optional): Name of the cache file. Default is '.slgrid_sph_cache'.
57+
58+
Returns:
59+
str: A string representation of the configuration file.
60+
61+
Raises:
62+
None
63+
"""
64+
65+
config = 'id: {:s}\n'.format(basis_id)
66+
config += 'parameters:\n'
67+
config += ' numr: {:d}\n'.format(numr)
68+
config += ' rmin: {:.7f}\n'.format(rmin)
69+
config += ' rmax: {:.3f}\n'.format(rmax)
70+
config += ' Lmax: {:d}\n'.format(lmax)
71+
config += ' nmax: {:d}\n'.format(nmax)
72+
config += ' rmapping: {:.3f}\n'.format(rmapping)
73+
config += ' modelname: {}\n'.format(modelname)
74+
config += ' cachename: {}\n'.format(cachename)
75+
return config
76+
4177

4278
def makebasis(pos, mass, basis_model, config=None, basis_id='sphereSL', time=0,
4379
r_s=1.0, r_c=0.0,

0 commit comments

Comments
 (0)