-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shim for deprecated API with warning. Old API will be removed in …
…exspy 1.0
- Loading branch information
Showing
9 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Deprecated and to be removed in exspy 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Deprecated and to be removed in exspy 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import warnings | ||
|
||
from hyperspy.exceptions import VisibleDeprecationWarning | ||
|
||
from exspy._misc.eds.utils import ( | ||
cross_section_to_zeta, | ||
electron_range, | ||
get_xray_lines_near_energy, | ||
take_off_angle, | ||
xray_range, | ||
zeta_to_cross_section, | ||
) | ||
|
||
|
||
warnings.warn( | ||
"This module is deprecated, use `exspy.utils.eds` instead. " | ||
"It will be removed in exspy 1.0.", | ||
VisibleDeprecationWarning, | ||
) | ||
|
||
__all__ = [ | ||
"cross_section_to_zeta", | ||
"electron_range", | ||
"get_xray_lines_near_energy", | ||
"take_off_angle", | ||
"xray_range", | ||
"zeta_to_cross_section", | ||
] | ||
|
||
|
||
def __dir__(): | ||
return sorted(__all__) | ||
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Deprecated and to be removed in exspy 1.0 | ||
|
||
import warnings | ||
|
||
from hyperspy.exceptions import VisibleDeprecationWarning | ||
|
||
from exspy.utils.eels import ( | ||
iMFP_angular_correction, | ||
iMFP_Iakoubovskii, | ||
iMFP_TPP2M, | ||
) | ||
|
||
__all__ = [ | ||
"iMFP_angular_correction", | ||
"iMFP_Iakoubovskii", | ||
"iMFP_TPP2M", | ||
] | ||
|
||
|
||
warnings.warn( | ||
"This module is deprecated, use `exspy.utils.eels` instead. " | ||
"It will be removed in exspy 1.0.", | ||
VisibleDeprecationWarning, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Deprecated and to be removed in exspy 1.0 | ||
|
||
import warnings | ||
|
||
from hyperspy.exceptions import VisibleDeprecationWarning | ||
|
||
from exspy.utils.eels import ( | ||
effective_angle, | ||
get_edges_near_energy, | ||
get_info_from_edges, | ||
) | ||
|
||
|
||
__all__ = [ | ||
"effective_angle", | ||
"get_edges_near_energy", | ||
"get_info_from_edges", | ||
] | ||
|
||
|
||
def __dir__(): | ||
return sorted(__all__) | ||
|
||
|
||
warnings.warn( | ||
"This module is deprecated, use `exspy.utils.eels` instead. " | ||
"It will be removed in exspy 1.0.", | ||
VisibleDeprecationWarning, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Deprecated and to be removed in exspy 1.0 | ||
|
||
import warnings | ||
|
||
from hyperspy.exceptions import VisibleDeprecationWarning | ||
|
||
from exspy._misc.elements import elements_db | ||
|
||
|
||
__all__ = [ | ||
"elements_db", | ||
] | ||
|
||
|
||
def __dir__(): | ||
return sorted(__all__) | ||
|
||
|
||
warnings.warn( | ||
"This module is deprecated, use `exspy.material` instead. " | ||
"It will be removed in exspy 1.0.", | ||
VisibleDeprecationWarning, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Deprecated and to be removed in exspy 1.0 | ||
|
||
import warnings | ||
|
||
from hyperspy.exceptions import VisibleDeprecationWarning | ||
|
||
from exspy.material import ( | ||
atomic_to_weight, | ||
density_of_mixture, | ||
mass_absorption_coefficient, | ||
mass_absorption_mixture, | ||
weight_to_atomic, | ||
) | ||
|
||
|
||
__all__ = [ | ||
"atomic_to_weight", | ||
"density_of_mixture", | ||
"mass_absorption_coefficient", | ||
"mass_absorption_mixture", | ||
"weight_to_atomic", | ||
] | ||
|
||
|
||
def __dir__(): | ||
return sorted(__all__) | ||
|
||
|
||
warnings.warn( | ||
"This module is deprecated, use `exspy.material` instead. " | ||
"It will be removed in exspy 1.0.", | ||
VisibleDeprecationWarning, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# ruff: noqa | ||
# Remove in exspy 1.0 | ||
|
||
import pytest | ||
|
||
from hyperspy.exceptions import VisibleDeprecationWarning | ||
|
||
|
||
def test_import_element(): | ||
with pytest.warns(VisibleDeprecationWarning) as record: | ||
from exspy.misc.elements import elements_db | ||
|
||
assert "use `exspy.material` instead" in record[0].message.args[0] | ||
|
||
|
||
def test_import_material(): | ||
with pytest.warns(VisibleDeprecationWarning) as record: | ||
from exspy.misc.material import ( | ||
atomic_to_weight, | ||
density_of_mixture, | ||
mass_absorption_coefficient, | ||
mass_absorption_mixture, | ||
weight_to_atomic, | ||
) | ||
|
||
assert "use `exspy.material` instead" in record[0].message.args[0] | ||
|
||
|
||
def test_import_eds_utils(): | ||
with pytest.warns(VisibleDeprecationWarning) as record: | ||
from exspy.misc.eds.utils import ( | ||
cross_section_to_zeta, | ||
electron_range, | ||
get_xray_lines_near_energy, | ||
take_off_angle, | ||
xray_range, | ||
zeta_to_cross_section, | ||
) | ||
|
||
assert "use `exspy.utils.eds` instead" in record[0].message.args[0] | ||
|
||
|
||
def test_import_eels_tools(): | ||
with pytest.warns(VisibleDeprecationWarning) as record: | ||
from exspy.misc.eels.tools import ( | ||
effective_angle, | ||
get_edges_near_energy, | ||
get_info_from_edges, | ||
) | ||
|
||
assert "use `exspy.utils.eels` instead" in record[0].message.args[0] | ||
|
||
|
||
def test_import_eels_electron_inelastic_mean_free_path(): | ||
with pytest.warns(VisibleDeprecationWarning) as record: | ||
from exspy.misc.eels.electron_inelastic_mean_free_path import ( | ||
iMFP_angular_correction, | ||
iMFP_Iakoubovskii, | ||
iMFP_TPP2M, | ||
) | ||
|
||
assert "use `exspy.utils.eels` instead" in record[0].message.args[0] |