Skip to content

Commit

Permalink
Add astropy import guard (tardis-sn#2470)
Browse files Browse the repository at this point in the history
* Add astropy import guard

* mailmap
  • Loading branch information
AlexHls authored Nov 15, 2023
1 parent 87e8f3a commit 84cf2e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Alexander Holas <[email protected]>
Alexander Holas <[email protected]>
Alexander Holas <[email protected]> AlexHls <[email protected]>
Alexander Holas <[email protected]> AlexHls <[email protected]>
Alexander Holas <[email protected]>

Alice Harpole <[email protected]>
Alice Harpole <[email protected]> Alice Harpole <[email protected]>
Expand Down
13 changes: 10 additions & 3 deletions tardis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
# ----------------------------------------------------------------------------

import sys
import warnings

# ----------------------------------------------------------------------------

from astropy import physical_constants, astronomical_constants
if ("astropy.units" in sys.modules) or ("astropy.constants" in sys.modules):
warnings.warn(
"Astropy is already imported externally. Astropy should be imported"
" after TARDIS."
)
else:
from astropy import physical_constants, astronomical_constants

physical_constants.set("codata2014")
astronomical_constants.set("iau2012")
physical_constants.set("codata2014")
astronomical_constants.set("iau2012")

# ----------------------------------------------------------------------------

Expand Down

0 comments on commit 84cf2e6

Please sign in to comment.