Skip to content

Commit

Permalink
Merge pull request #368 from vhaasteren/astropy_optional
Browse files Browse the repository at this point in the history
Astropy optional
  • Loading branch information
AaronDJohnson authored Nov 29, 2023
2 parents d782c29 + c4fe43e commit 29ebfe6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enterprise/pulsar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import os
import pickle

import astropy.constants as const
import astropy.units as u
import numpy as np
from ephem import Ecliptic, Equatorial

Expand All @@ -34,6 +32,13 @@
logger.warning("PINT not installed. Will use libstempo instead.") # pragma: no cover
pint = None

try:
import astropy.constants as const
import astropy.units as u
except ImportError: # pragma: no cover
const = None
u = None

if pint is None and t2 is None:
err_msg = "Must have either PINT or libstempo timing package installed"
raise ImportError(err_msg)
Expand Down

0 comments on commit 29ebfe6

Please sign in to comment.