Skip to content

Commit

Permalink
changed all files to import constants from only tardis (#1825)
Browse files Browse the repository at this point in the history
* changed all libraries to import constants from tardis

* updated the .mailmap file, to be merged
  • Loading branch information
shilpiprd authored Nov 25, 2021
1 parent 3dd7294 commit c34beca
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ Ran Livneh <[email protected]> Ran Livneh <[email protected]>

Sampark Sharma <[email protected]>

Shilpi Prasad <[email protected]>

Sourav Singh <[email protected]>

Srinath Rajagopalan <[email protected]>
Expand Down
3 changes: 2 additions & 1 deletion docs/physics/pyplot/plot_mu_in_out_packet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pylab import *
from astropy import units as u, constants as const
from astropy import units as u
from tardis import constants as const

x, y = x, y = mgrid[1:1000, 1:1000]
mu_in = x / 500.0 - 1
Expand Down
6 changes: 3 additions & 3 deletions tardis/io/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import yaml
from tqdm.auto import tqdm

from tardis import constants
from tardis import constants as const
from astropy import units as u

from tardis import __path__ as TARDIS_PATH
Expand Down Expand Up @@ -49,12 +49,12 @@ def quantity_from_str(text):
value_str, unit_str = text.split(None, 1)
value = float(value_str)
if unit_str.strip() == "log_lsun":
value = 10 ** (value + np.log10(constants.L_sun.cgs.value))
value = 10 ** (value + np.log10(const.L_sun.cgs.value))
unit_str = "erg/s"

unit = u.Unit(unit_str)
if unit == u.L_sun:
return value * constants.L_sun
return value * const.L_sun

return u.Quantity(value, unit_str)

Expand Down
3 changes: 2 additions & 1 deletion tardis/montecarlo/tests/test_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import numpy as np
import pandas as pd
import os
from astropy import units as u, constants as c
from astropy import units as u
from tardis import constants as c
import astropy.tests.helper as test_helper
from numpy.testing import assert_almost_equal
from tardis.montecarlo.spectrum import (
Expand Down
3 changes: 2 additions & 1 deletion tardis/simulation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import logging
import numpy as np
import pandas as pd
from astropy import units as u, constants as const
from astropy import units as u
from tardis import constants as const
from collections import OrderedDict
from tardis import model

Expand Down

0 comments on commit c34beca

Please sign in to comment.