Skip to content

Commit

Permalink
Move imports with optional dependencies inside from_model functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccafair committed May 27, 2020
1 parent c42cd7e commit 76a689a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions euphonic/force_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from euphonic.crystal import Crystal
from euphonic.qpoint_phonon_modes import QpointPhononModes
from euphonic.util import is_gamma, get_all_origins, _check_constructor_inputs
from euphonic.readers import castep
from euphonic.readers import phonopy
from euphonic.io import (_obj_to_json_file, _obj_from_json_file,
_obj_to_dict, _process_dict)

Expand Down Expand Up @@ -1266,6 +1264,7 @@ def from_castep(cls, filename):
-------
ForceConstants
"""
from euphonic.readers import castep
data = castep._read_interpolation_data(filename)
return cls.from_dict(data)

Expand Down Expand Up @@ -1303,6 +1302,7 @@ def from_phonopy(cls, path='.', summary_name='phonopy.yaml',
-------
ForceConstants
"""
from euphonic.readers import phonopy
data = phonopy._read_interpolation_data(
path=path, summary_name=summary_name, born_name=born_name,
fc_name=fc_name, fc_format=fc_format)
Expand Down
4 changes: 2 additions & 2 deletions euphonic/qpoint_phonon_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from euphonic.structure_factor import StructureFactor
from euphonic.util import (direction_changed, is_gamma,
_check_constructor_inputs)
from euphonic.readers import castep
from euphonic.readers import phonopy
from euphonic.io import (_obj_to_json_file, _obj_from_json_file,
_obj_to_dict, _process_dict)

Expand Down Expand Up @@ -472,6 +470,7 @@ def from_castep(cls, filename):
-------
QpointPhononModes
"""
from euphonic.readers import castep
data = castep._read_phonon_data(filename)
return cls.from_dict(data)

Expand Down Expand Up @@ -503,6 +502,7 @@ def from_phonopy(cls, path='.', phonon_name='band.yaml',
-------
QpointPhononModes
"""
from euphonic.readers import phonopy
data = phonopy._read_phonon_data(
path=path, phonon_name=phonon_name, phonon_format=phonon_format,
summary_name=summary_name)
Expand Down

0 comments on commit 76a689a

Please sign in to comment.