Skip to content

Commit 575a72d

Browse files
authored
Wrap create_assist_ephemeris function so argparse object is not required. (#1138)
* Wrap `create_assist_ephemeris` function so argparse object is not required. * Fixing lint error.
1 parent 636e563 commit 575a72d

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/sorcha/ephemeris/simulation_setup.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,34 @@ def create_assist_ephemeris(args, auxconfigs) -> tuple:
3030
"""Build the ASSIST ephemeris object
3131
Parameter
3232
---------
33+
args: dictionary
34+
Dictionary of command-line arguments.
3335
auxconfigs: dataclass
3436
Dataclass of auxiliary configuration file arguments.
3537
Returns
3638
---------
37-
Ephem : ASSIST ephemeris obejct
39+
Ephem : ASSIST ephemeris object
40+
The ASSIST ephemeris object
41+
gm_sun : float
42+
value for the GM_SUN value
43+
gm_total : float
44+
value for gm_total
45+
"""
46+
cache_directory = args.ar_data_file_path
47+
return _create_assist_ephemeris(auxconfigs, cache_directory)
48+
49+
50+
def _create_assist_ephemeris(auxconfigs, cache_dir=None) -> tuple:
51+
"""Build the ASSIST ephemeris object
52+
Parameter
53+
---------
54+
auxconfigs: dataclass
55+
Dataclass of auxiliary configuration file arguments.
56+
cache_dir: string
57+
The base directory to place all downloaded files. Default = None
58+
Returns
59+
---------
60+
Ephem : ASSIST ephemeris object
3861
The ASSIST ephemeris object
3962
gm_sun : float
4063
value for the GM_SUN value
@@ -43,7 +66,7 @@ def create_assist_ephemeris(args, auxconfigs) -> tuple:
4366
"""
4467
pplogger = logging.getLogger(__name__)
4568

46-
retriever = make_retriever(auxconfigs, args.ar_data_file_path)
69+
retriever = make_retriever(auxconfigs, cache_dir)
4770
planets_file_path = retriever.fetch(auxconfigs.jpl_planets)
4871
small_bodies_file_path = retriever.fetch(auxconfigs.jpl_small_bodies)
4972
ephem = Ephem(planets_path=planets_file_path, asteroids_path=small_bodies_file_path)

0 commit comments

Comments
 (0)