From f81b4d63b05b1127950b2a88b89a0a16a69d6693 Mon Sep 17 00:00:00 2001 From: Will Barnes Date: Tue, 27 Aug 2024 21:00:48 -0400 Subject: [PATCH] add docstring for build_configuration --- ebtelplusplus/high_level.py | 20 ++++++++++++++++++-- ebtelplusplus/tests/test_compare_idl.py | 12 ++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ebtelplusplus/high_level.py b/ebtelplusplus/high_level.py index b619e85..eb5ca23 100644 --- a/ebtelplusplus/high_level.py +++ b/ebtelplusplus/high_level.py @@ -68,14 +68,30 @@ def run(total_time: u.s, loop_length: u.cm, heating, physics=None, solver=None, physics = PhysicsModel() if dem is None: dem = DemModel() - config = build_configuration(total_time, loop_length, solver, physics, dem, heating) + config = build_configuration(total_time, loop_length, heating, physics, solver, dem) results = ebtelplusplus._low_level.run(config) return EbtelResult(**{k: u.Quantity(v, _UNITS_MAPPING[k]) for k,v in results.items()}) -def build_configuration(total_time, loop_length, solver, physics, dem, heating): +@u.quantity_input +def build_configuration(total_time:u.s, loop_length:u.cm, heating, physics, solver, dem): """ Helper function for building a dictionary of ebtel++ configuration options + + Parameters + ---------- + total_time: `~astropy.units.Quantity` + Total duration of the simulation + loop_length: `~astropy.units.Quantity` + Loop half length + heating_model: `~ebtelplusplus.models.HeatingModel` + Configuration of heating model + physics_model: `~ebtelplusplus.models.PhysicsModel` + Configuration parameters related to the physics of the simulation + solver_model: `~ebtelplusplus.models.SolverModel` + Configuration parameters related to the numerical solver + dem_model: `~ebtelplusplus.models.DemModel` + Configuration parameters related to the DEM calculation """ return { 'total_time': total_time.to_value('s'), diff --git a/ebtelplusplus/tests/test_compare_idl.py b/ebtelplusplus/tests/test_compare_idl.py index 34339da..1c8701f 100644 --- a/ebtelplusplus/tests/test_compare_idl.py +++ b/ebtelplusplus/tests/test_compare_idl.py @@ -59,10 +59,10 @@ def test_compare_idl_single_event(physics_model, solver=solver_model) config_dict = ebtelplusplus.build_configuration(total_time, loop_length, - solver_model, + heating_model, physics_model, - DemModel(), - heating_model) + solver_model, + DemModel()) r_idl = read_idl_test_data( 'idl_single_event.txt', ebtel_idl_path, @@ -100,10 +100,10 @@ def test_compare_idl_area_expansion( solver=solver_model) config_dict = ebtelplusplus.build_configuration(total_time, loop_length, - solver_model, + heating_model, physics_model, - DemModel(), - heating_model) + solver_model, + DemModel()) r_idl = read_idl_test_data(f'idl_area_expansion_{A_c=}_{A_0=}_{A_tr=}.txt', ebtel_idl_path, config_dict) if plot_idl_comparisons: plot_comparison(r_cpp, r_idl)