Skip to content

Commit

Permalink
apply precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes committed Aug 28, 2024
1 parent 69c9c9a commit 8c663a9
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 30 deletions.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import datetime
import os

# -- Project information -----------------------------------------------------

# The full version, including alpha/beta/rc tags
from ebtelplusplus import __version__

# -- Project information -----------------------------------------------------


release = __version__
is_development = '.dev' in __version__

Expand Down Expand Up @@ -137,4 +138,3 @@
'doc_module': ('ebtelplusplus',),
'only_warn_on_example_error': True,
}

2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ EBTEL also calculates the differential emission measure (DEM) for both the trans
Details regarding this formulation can be found in :cite:t:`klimchuk_highly_2008`.

.. note::

If you are looking for the original IDL implementation,
the repository for the original IDL code can be found `here <https://github.com/rice-solar-physics/EBTEL>`__.

Expand Down
2 changes: 1 addition & 1 deletion ebtelplusplus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
ebtelplusplus: Zero-dimensional hydrodynamics of coronal loops
"""
from ebtelplusplus.high_level import run, build_configuration
from ebtelplusplus.high_level import build_configuration, run

try:
from ebtelplusplus._version import __version__
Expand Down
2 changes: 1 addition & 1 deletion ebtelplusplus/_low_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""
from ._core import run

__all__ = ["run"]
__all__ = ["run"]
2 changes: 1 addition & 1 deletion ebtelplusplus/extern/heater.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
heater.cpp
Class defnition for heater object
Class definition for heater object
*/

#include "heater.h"
Expand Down
7 changes: 4 additions & 3 deletions ebtelplusplus/high_level.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""
High level interface to running an ebtel++ simulation
"""
from collections import namedtuple

import astropy.units as u

from astropy.utils.data import get_pkg_data_path
from collections import namedtuple

import ebtelplusplus._low_level

from ebtelplusplus.models import DemModel, PhysicsModel, SolverModel

__all__ = ["run", "build_configuration"]
Expand Down Expand Up @@ -54,7 +55,7 @@ def run(total_time: u.s, loop_length: u.cm, heating, physics=None, solver=None,
solver_model: `~ebtelplusplus.models.SolverModel`, optional
Configuration parameters related to the numerical solver
dem_model: `~ebtelplusplus.models.DemModel`, optional
Configruation parameters related to the DEM calculation
Configuration parameters related to the DEM calculation
Returns
-------
Expand Down
13 changes: 6 additions & 7 deletions ebtelplusplus/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""
Models for configuring ebtel++ runs
"""
import dataclasses

import astropy.units as u
import dataclasses

__all__ = [
'PhysicsModel',
Expand Down Expand Up @@ -50,14 +49,14 @@ class PhysicsModel:
abundances), or "variable" (to vary the radiative loss function from
coronal to photospheric as a function of density and temperature).
loop_length_ratio_tr_total: `float`
Ratio between the length of the transition region and the total loop
Ratio between the length of the transition region and the total loop
length. For a transition region of finite length, a typical value of
0.15 is used :cite:p:`cargill_static_2022`.
area_ratio_tr_corona: `float`
Ratio between the cross-sectional area averaged over the transition
Ratio between the cross-sectional area averaged over the transition
region and averaged over the corona
area_ratio_0_corona: `float`
Ratio between the cross-sectional area at the TR-corona boundary and
Ratio between the cross-sectional area at the TR-corona boundary and
the cross-sectional area averaged over the corona
"""
saturation_limit: float = None
Expand Down Expand Up @@ -134,7 +133,7 @@ class DemModel:
calculate_dem: `bool`
If true, calculate the coronal and transition region DEM
use_new_tr_method: `bool`
If true, the transition region DEM is calculated using the method
If true, the transition region DEM is calculated using the method
outlined in section 3 (the appendix) of :cite:t:`klimchuk_highly_2008`.
temperature_bins: `int`
Number of bins to use when calculating the DEM
Expand Down Expand Up @@ -259,7 +258,7 @@ class HeatingModel:
ebtel++ input parameters for the time-dependent heating
The ebtel++ time-dependent heating model is parameterized by a
series of discrete events (`HeatingEvent`) combined with a constant
series of discrete events (`HeatingEvent`) combined with a constant
background heating rate. Furthermore, this energy can be injected into
either the electrons or the ions or some admixture of the two.
Expand Down
4 changes: 2 additions & 2 deletions ebtelplusplus/tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
Helper functions for tests
"""
import pathlib

import astropy.units as u
import h5py
import numpy as np
import pathlib

from astropy.utils.data import get_pkg_data_path


Expand Down
4 changes: 3 additions & 1 deletion ebtelplusplus/tests/test_compare_hydrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"""
import astropy.units as u
import pytest

from scipy.interpolate import interp1d

import ebtelplusplus

from ebtelplusplus.models import (
HeatingModel,
PhysicsModel,
Expand Down Expand Up @@ -53,7 +55,7 @@ def test_compare_hydrad_single_event_peak_values(tau, heating_type, solver_model
# done in Barnes et al. (2016a)
for name in ['electron_temperature', 'ion_temperature', 'density']:
f_interp = interp1d(r_ebtel.time.to_value('s'),
getattr(r_ebtel, name).to_value(r_hydrad[name].unit),
getattr(r_ebtel, name).to_value(r_hydrad[name].unit),
fill_value='extrapolate')
x_ebtel_interp = u.Quantity(f_interp(r_hydrad['time'].to_value('s')), r_hydrad[name].unit)
i_peak = r_hydrad[name].argmax()
Expand Down
3 changes: 2 additions & 1 deletion ebtelplusplus/tests/test_compare_idl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest

import ebtelplusplus

from ebtelplusplus.models import (
DemModel,
HeatingModel,
Expand Down Expand Up @@ -73,7 +74,7 @@ def test_compare_idl_single_event(physics_model,
assert u.allclose(r_cpp.ion_temperature, r_idl['temperature'], rtol=RTOL)
assert u.allclose(r_cpp.density, r_idl['density'], rtol=RTOL)
assert u.allclose(r_cpp.electron_pressure+r_cpp.ion_pressure,
r_idl['pressure'],
r_idl['pressure'],
rtol=RTOL)
assert u.allclose(r_cpp.velocity, r_idl['velocity'], rtol=RTOL)

Expand Down
1 change: 1 addition & 0 deletions ebtelplusplus/tests/test_rad_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest

import ebtelplusplus

from ebtelplusplus.models import HeatingModel, PhysicsModel, TriangularHeatingEvent


Expand Down
1 change: 1 addition & 0 deletions ebtelplusplus/tests/test_single_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest

import ebtelplusplus

from ebtelplusplus.models import HeatingEvent, HeatingModel, PhysicsModel


Expand Down
6 changes: 3 additions & 3 deletions ebtelplusplus/tests/test_solver.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Compare results of adaptive and static solvers
"""
import copy

import astropy.units as u
import numpy as np
import pytest

import ebtelplusplus

from ebtelplusplus.models import (
HeatingModel,
PhysicsModel,
Expand Down Expand Up @@ -53,7 +53,7 @@ def adaptive_results(physics_model, adaptive_solver, heating_model):
40*u.Mm,
heating_model,
physics=physics_model,
solver=adaptive_solver)
solver=adaptive_solver)


@pytest.fixture()
Expand All @@ -62,7 +62,7 @@ def static_results(physics_model, static_solver, heating_model):
40*u.Mm,
heating_model,
physics=physics_model,
solver=static_solver)
solver=static_solver)


@pytest.mark.parametrize(('name', 'atol'), [
Expand Down
4 changes: 3 additions & 1 deletion examples/electron_single_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
and injecting 10 ergs per cubic centimeter into the loop plasma.
"""
import astropy.units as u
from astropy.visualization import quantity_support
import matplotlib.pyplot as plt
import numpy as np

from astropy.visualization import quantity_support

import ebtelplusplus

from ebtelplusplus.models import DemModel, HeatingModel, TriangularHeatingEvent

quantity_support()
Expand Down
4 changes: 3 additions & 1 deletion examples/ion_multi_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
200 seconds with heating rates chosen from a uniform distribution.
"""
import astropy.units as u
from astropy.visualization import quantity_support
import matplotlib.pyplot as plt
import numpy as np

from astropy.visualization import quantity_support

import ebtelplusplus

from ebtelplusplus.models import DemModel, HeatingModel, SquareHeatingEvent

quantity_support()
Expand Down
6 changes: 4 additions & 2 deletions examples/single_trapezoid_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
same temperature to illustrate the single fluid case.
"""
import astropy.units as u
from astropy.visualization import quantity_support
import matplotlib.pyplot as plt
import numpy as np

from astropy.visualization import quantity_support

import ebtelplusplus
from ebtelplusplus.models import DemModel, HeatingModel, HeatingEvent, PhysicsModel

from ebtelplusplus.models import DemModel, HeatingEvent, HeatingModel, PhysicsModel

quantity_support()

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ lines_between_types = 1

[tool.codespell]
skip = "*.fts,*.fits,venv,*.pro,*.bib,*.asdf,*.json"
ignore-words-list = ""
#ignore-words-list = ""

[tool.ruff]
target-version = "py310"
Expand Down Expand Up @@ -177,4 +177,3 @@ lint.extend-ignore = [

[tool.ruff.lint.pydocstyle]
convention = "numpy"

0 comments on commit 8c663a9

Please sign in to comment.