Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed all files to import constants from only tardis #1825

Merged
merged 2 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <ran.livneh@weizmann.ac.il> Ran Livneh <livnehra@gmail.com>

Sampark Sharma <samparksharma2000@gmail.com>

Shilpi Prasad <shilpiprd@gmail.com>

Sourav Singh <souravsingh@users.noreply.github.com>

Srinath Rajagopalan <srinath132@gmail.com>
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change isn't strictly necessary to fix the underlying issue. Nevertheless, it should be fine to keep it.

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