Skip to content

Commit

Permalink
Merge pull request #8 from AstarVienna/hb/bugfix/removevegamag
Browse files Browse the repository at this point in the history
Remove vegamag, release 0.33
  • Loading branch information
hugobuddel committed Mar 21, 2023
2 parents 345ffa8 + f2479a0 commit 17adab9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
15 changes: 10 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@
# Version number
MAJOR = 0
MINOR = 3
ATTR = '2'
ATTR = '3'

VERSION = '%d.%d%s' % (MAJOR, MINOR, ATTR)


def write_version(filename='spextra/version.py'):
"""Write a file version.py"""
cnt = """# THIS FILE GENERATED BY speXtra setup.py
version = '{}'
date = '{}'
"""
timestamp = datetime.utcnow().strftime('%Y-%m-%d %T GMT')
version = '{}'
date = '{}'
"""
# This timestamp used to contain a timestamp. However, the result of that
# was that creating a package with `python -m build` would change the
# version.py in the build packages. Therefor the contents of the packages
# would not correspond to any version of git, which is a bad thing.
# Therefor this now only contains the date.
timestamp = datetime.utcnow().strftime('%Y-%m-%d')
with open(filename, 'w', encoding='utf-8') as fd:
if sys.version_info.major == 2:
fd.write(cnt.format(VERSION, timestamp).decode('utf-8'))
Expand Down
8 changes: 7 additions & 1 deletion spextra/spextra.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,13 @@ def flat_spectrum(cls, amplitude=0, waves=None):
if isinstance(amplitude, u.Quantity) is False:
amplitude = amplitude*u.ABmag

if amplitude.unit is u.Unit("mag") or amplitude.unit is u.Unit("vegamag"):
# The if-statement below also allowed amplitude.unit to be
# u.Unit("vegamag"). Vegamag is removed from astropy, so the
# if-statement is removed too. This assertion is added as a sanity
# check ensure that any bugs introduced by changing the if-statement
# is explicitly raised here, instead of silently propagated.
assert not amplitude.unit.to_string() == "vegamag", "The use of vegamag is deprecated."
if amplitude.unit is u.Unit("mag"):
spec = get_vega_spectrum()
spec = spec * 10 ** (-0.4 * amplitude.value)
system_name = amplitude.unit
Expand Down
5 changes: 2 additions & 3 deletions spextra/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# THIS FILE GENERATED BY speXtra setup.py
version = '0.32'
date = '2023-03-13 20:02:25 GMT'

version = '0.33'
date = '2023-03-21'

0 comments on commit 17adab9

Please sign in to comment.