Skip to content

Commit

Permalink
dem options no longer passed as nested dict
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes committed Aug 25, 2024
1 parent 3c71246 commit 881a921
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/ebtelplusplus/high_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def build_configuration(total_time, loop_length, solver, physics, dem, heating):
'radiation_data_dir': get_pkg_data_path('radiation', package='ebtelplusplus.data'),
**solver.to_dict(),
**physics.to_dict(),
'calculate_dem': dem.calculate_dem,
'dem': dem.to_dict(),
**dem.to_dict(),
'heating': heating.to_dict(),
}
15 changes: 9 additions & 6 deletions src/ebtelplusplus/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,25 @@ class DemModel:
Parameters
----------
calculate_dem
use_new_method
use_new_tr_method
temperature_bins
log_temperature_min
log_temperature_max
"""
calculate_dem: bool = False
use_new_method: bool = True
use_new_tr_method: bool = True
temperature_bins: int = 451
temperature_min: u.Quantity[u.K] = 10**4*u.K
temperature_max: u.Quantity[u.K] = 10**8.5*u.K

def to_dict(self):
config = dataclasses.asdict(self)
config['temperature_min'] = config['temperature_min'].to_value('K')
config['temperature_max'] = config['temperature_max'].to_value('K')
return config
return {
'calculate_dem': self.calculate_dem,
'dem_use_new_tr_method': self.use_new_tr_method,
'dem_temperature_bins': self.temperature_bins,
'dem_temperature_min': self.temperature_min.to_value('K'),
'dem_temperature_max': self.temperature_max.to_value('K'),
}


class HeatingEvent:
Expand Down

0 comments on commit 881a921

Please sign in to comment.