Skip to content

Commit ec699ea

Browse files
authored
Minor updates (#120)
* pypi badge * enable nitpicky * refactor high-level and heating event interfaces * add cron workflow
1 parent 93dfa3e commit ec699ea

17 files changed

+104
-48
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Scheduled builds
2+
3+
on:
4+
# Allow manual runs through the web UI
5+
workflow_dispatch:
6+
schedule:
7+
# ┌───────── minute (0 - 59)
8+
# │ ┌───────── hour (0 - 23)
9+
# │ │ ┌───────── day of the month (1 - 31)
10+
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
11+
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
12+
- cron: '0 12 * * 1' # Every Mon at 12:00 UTC
13+
14+
jobs:
15+
dispatch_workflows:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: gh workflow run ci.yml --repo rice-solar-physics/ebtelplusplus --ref main
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![Documentation Status](https://readthedocs.org/projects/ebtelplusplus/badge/?version=latest)](https://ebtelplusplus.readthedocs.io/en/latest/?badge=latest)
55
[![codecov](https://codecov.io/gh/rice-solar-physics/ebtelplusplus/branch/main/graph/badge.svg?token=8G5H9T5AAH)](https://codecov.io/gh/rice-solar-physics/ebtelplusplus)
66
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.12675386.svg)](https://doi.org/10.5281/zenodo.12675386)
7+
[![PyPI](https://img.shields.io/pypi/v/ebtelplusplus.svg)](https://pypi.org/project/ebtelplusplus)
78

89
`ebtelplusplus` is an implementation of the enthalpy-based thermal evolution of loops (EBTEL) model for doing
910
efficient hydrodynamics of dynamically-heated solar coronal loops.
@@ -37,7 +38,7 @@ heating = HeatingModel(
3738
partition=1,
3839
events=[TriangularHeatingEvent(0*u.s, 200*u.s, 0.1*u.Unit('erg cm-3 s-1'))]
3940
)
40-
results = ebtelplusplus.run(2*u.h, 40*u.Mm, heating)
41+
results = ebtelplusplus.run(2*u.h, 40*u.Mm, heating=heating)
4142
```
4243

4344
## Citation

docs/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@
7070
# Treat everything in single ` as a Python reference.
7171
default_role = 'py:obj'
7272

73+
# Enable nitpicky mode, which forces links to be non-broken
74+
nitpicky = True
75+
# This is not used. See docs/nitpick-exceptions file for the actual listing.
76+
nitpick_ignore = []
77+
for line in open('nitpick-exceptions'):
78+
if line.strip() == "" or line.startswith("#"):
79+
continue
80+
dtype, target = line.split(None, 1)
81+
target = target.strip()
82+
nitpick_ignore.append((dtype, target))
83+
7384
# -- Options for intersphinx extension ---------------------------------------
7485

7586
# Example configuration for intersphinx: refer to the Python standard library.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ebtelplusplus
4040

4141
:material-outlined:`code;8em;sd-text-secondary`
4242

43-
Instructions for how to contribute to `ebtelplusplus`
43+
Instructions for how to contribute to ``ebtelplusplus``
4444

4545
.. grid-item-card:: Reference
4646
:link: ebtelplusplus-reference

docs/nitpick-exceptions

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Prevents sphinx nitpicky mode picking up on optional
2+
# (see https://github.com/sphinx-doc/sphinx/issues/6861)
3+
# Even if it was "fixed", still broken
4+
py:class optional
5+
# See https://github.com/numpy/numpy/issues/10039
6+
py:obj numpy.datetime64
7+
# There's no specific file or function classes to link to
8+
py:class any type
9+
py:class array-like
10+
py:class file object
11+
py:class function
12+
py:class path-like
13+
py:class str-like
14+
py:class time-like
15+
py:obj function
16+
py:obj iterable
17+
# Units
18+
py:class Unit
19+
py:class Unit('1 / cm3')
20+
py:class Unit('erg')
21+
py:class Unit('Angstrom')
22+
py:class Unit('1 / cm5')
23+
py:class Unit('K')

docs/topic_guides/derivation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Deriving the EBTEL Equations
44
============================
55

66
This page will briefly summarize the derivation of the version of the EBTEL
7-
model used in `ebtelplusplus` which includes cross-sectional area expansion
7+
model used in ``ebtelplusplus`` which includes cross-sectional area expansion
88
and two-fluid effects.
99
For a more detailed explanation of the EBTEL model, including the physical
1010
motivation behind the assumptions, see :cite:t:`klimchuk_highly_2008`.

ebtelplusplus/high_level.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
@u.quantity_input
18-
def run(total_time: u.s, loop_length: u.cm, heating=None, physics=None, solver=None, dem=None):
18+
def run(total_time: u.s, loop_length: u.cm, *, heating=None, physics=None, solver=None, dem=None):
1919
"""
2020
Run an ebtelplusplus simulation
2121

ebtelplusplus/models.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ class HeatingEvent:
171171
172172
Parameters
173173
----------
174-
rise_start: `~astropy.units.Quantity`
174+
start: `~astropy.units.Quantity`
175175
Time at which the heating event starts
176-
rise_end: `~astropy.units.Quantity`
177-
Time at which the rise phase stops (and the constant phase starts)
178-
decay_start: `~astropy.units.Quantity`
179-
Time at which the decay phase starts (and the constant phase stops)
176+
duration: `~astropy.units.Quantity`
177+
Total duration of the heating event
178+
duration_rise: `~astropy.units.Quantity`
179+
Duration of the linear rise phase of the event
180180
decay_end: `~astropy.units.Quantity`
181-
Time at which the decay phase and the event ends
181+
Duration of the linear decay phase of the event
182182
rate: `~astropy.units.Quantity`
183183
The maximum heating rate of the event
184184
@@ -189,11 +189,12 @@ class HeatingEvent:
189189
"""
190190

191191
@u.quantity_input
192-
def __init__(self, rise_start: u.s, rise_end: u.s, decay_start: u.s, decay_end: u.s, rate: u.Unit('erg cm-3 s-1')):
193-
self.rise_start = rise_start
194-
self.rise_end = rise_end
195-
self.decay_start = decay_start
196-
self.decay_end = decay_end
192+
def __init__(self, start: u.s, duration: u.s, duration_rise: u.s, duration_decay: u.s, rate: u.Unit('erg cm-3 s-1')):
193+
self.rise_start = start
194+
self.rise_end = self.rise_start + duration_rise
195+
duration_constant = duration - duration_rise - duration_decay
196+
self.decay_start = self.rise_end + duration_constant
197+
self.decay_end = self.decay_start + duration_decay
197198
self.rate = rate
198199

199200
def to_dict(self):
@@ -213,20 +214,20 @@ class TriangularHeatingEvent(HeatingEvent):
213214
214215
Parameters
215216
----------
216-
rise_start: `~astropy.units.Quantity`
217+
start: `~astropy.units.Quantity`
217218
Time at which the heating event starts
218219
duration: `~astropy.units.Quantity`
219220
Total duration of the event
220221
rate: `~astropy.units.Quantity`
221222
The maximum heating rate of the event
222223
"""
223224

224-
def __init__(self, rise_start, duration, rate):
225+
def __init__(self, start, duration, rate):
225226
super().__init__(
226-
rise_start,
227-
rise_start+duration/2,
228-
rise_start+duration/2,
229-
rise_start+duration,
227+
start,
228+
duration,
229+
duration/2,
230+
duration/2,
230231
rate,
231232
)
232233

@@ -237,20 +238,20 @@ class SquareHeatingEvent(HeatingEvent):
237238
238239
Parameters
239240
----------
240-
rise_start: `~astropy.units.Quantity`
241+
start: `~astropy.units.Quantity`
241242
Time at which the heating event starts
242243
duration: `~astropy.units.Quantity`
243244
Total duration of the event
244245
rate: `~astropy.units.Quantity`
245246
The maximum heating rate of the event
246247
"""
247248

248-
def __init__(self, rise_start, duration, rate):
249+
def __init__(self, start, duration, rate):
249250
super().__init__(
250-
rise_start,
251-
rise_start,
252-
rise_start+duration,
253-
rise_start+duration,
251+
start,
252+
duration,
253+
0*u.s,
254+
0*u.s,
254255
rate,
255256
)
256257

ebtelplusplus/tests/test_compare_hydrad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_compare_hydrad_single_event_peak_values(tau, heating_type, solver_model
4747
force_single_fluid=force_single_fluid)
4848
r_ebtel = ebtelplusplus.run(5e3*u.s,
4949
40*u.Mm,
50-
heating_model,
50+
heating=heating_model,
5151
physics=physics_model,
5252
solver=solver_model,)
5353
r_hydrad = read_hydrad_test_data(tau.to_value('s'), heating_type)

ebtelplusplus/tests/test_compare_idl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_compare_idl_single_event(physics_model,
5353
loop_length = 40 * u.Mm
5454
r_cpp = ebtelplusplus.run(total_time,
5555
loop_length,
56-
heating_model,
56+
heating=heating_model,
5757
physics=physics_model,
5858
solver=solver_model)
5959

@@ -89,7 +89,7 @@ def test_compare_idl_area_expansion(
8989
loop_length = 40 * u.Mm
9090
r_cpp = ebtelplusplus.run(total_time,
9191
loop_length,
92-
heating_model,
92+
heating=heating_model,
9393
physics=physics_model,
9494
solver=solver_model)
9595
r_idl = read_idl_test_data(f'idl_area_expansion_{A_c=}_{A_0=}_{A_tr=}.txt', ebtel_idl_path, r_cpp.inputs)

0 commit comments

Comments
 (0)