Skip to content

Commit

Permalink
change codestyle to black for io (#1202)
Browse files Browse the repository at this point in the history
* change codestyle to black for io

* Update tardis/io/atom_data/util.py

Co-authored-by: Jaladh Singhal <[email protected]>

Co-authored-by: Jaladh Singhal <[email protected]>
  • Loading branch information
wkerzendorf and jaladh-singhal authored Jun 26, 2020
1 parent 9adb5b4 commit 88d487d
Show file tree
Hide file tree
Showing 24 changed files with 1,074 additions and 676 deletions.
8 changes: 6 additions & 2 deletions tardis/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#readin model_data
from tardis.io.model_reader import read_simple_ascii_density, read_simple_ascii_abundances, read_density_file
# readin model_data
from tardis.io.model_reader import (
read_simple_ascii_density,
read_simple_ascii_abundances,
read_density_file,
)

from tardis.io.config_internal import get_internal_configuration, get_data_dir
2 changes: 1 addition & 1 deletion tardis/io/atom_data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from tardis.io.atom_data.base import AtomData
from tardis.io.atom_data.atom_web_download import download_atom_data
from tardis.io.atom_data.atom_web_download import download_atom_data
19 changes: 12 additions & 7 deletions tardis/io/atom_data/atom_web_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

logger = logging.getLogger(__name__)


def get_atomic_repo_config():
"""
Get the repo configuration dictionary for the atomic data
Expand All @@ -17,7 +18,7 @@ def get_atomic_repo_config():
"""

atomic_repo_fname = get_internal_data_path('atomic_data_repo.yml')
atomic_repo_fname = get_internal_data_path("atomic_data_repo.yml")
return yaml.load(open(atomic_repo_fname), Loader=yaml.CLoader)


Expand All @@ -38,11 +39,15 @@ def download_atom_data(atomic_data_name=None):
atomic_repo = get_atomic_repo_config()

if atomic_data_name is None:
atomic_data_name = atomic_repo['default']
atomic_data_name = atomic_repo["default"]

if atomic_data_name not in atomic_repo:
raise ValueError('Atomic Data name {0} not known'.format(atomic_data_name))
dst_dir = os.path.join(get_data_dir(), '{0}.h5'.format(atomic_data_name))
src_url = atomic_repo[atomic_data_name]['url']
logger.info('Downloading atomic data from {0} to {1}'.format(src_url, dst_dir))
download_from_url(src_url, dst_dir)
raise ValueError(
"Atomic Data name {0} not known".format(atomic_data_name)
)
dst_dir = os.path.join(get_data_dir(), "{0}.h5".format(atomic_data_name))
src_url = atomic_repo[atomic_data_name]["url"]
logger.info(
"Downloading atomic data from {0} to {1}".format(src_url, dst_dir)
)
download_from_url(src_url, dst_dir)
Loading

0 comments on commit 88d487d

Please sign in to comment.