Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed May 22, 2024
1 parent 7d248b4 commit 7d920a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/nomad_simulations/properties/spectral_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,15 +585,15 @@ def generate_from_contributions(self, logger: BoundLogger) -> None:
# TODO check if this method is general enough
if self.xanes_spectrum is not None and self.exafs_spectrum is not None:
# Concatenate XANE and EXAFS `Energy` grid points
xanes_energies = get_variables(self.xanes_spectrum.variables, Energy)
exafs_energies = get_variables(self.exafs_spectrum.variables, Energy)
if len(xanes_energies) == 0 or len(exafs_energies) == 0:
xanes_variables = get_variables(self.xanes_spectrum.variables, Energy)
exafs_variables = get_variables(self.exafs_spectrum.variables, Energy)
if len(xanes_variables) == 0 or len(exafs_variables) == 0:
logger.warning(
'Could not extract the `Energy` grid points from XANES or EXAFS.'
)
return
xanes_energies = xanes_energies[0].points
exafs_energies = exafs_energies[0].points
xanes_energies = xanes_variables[0].points
exafs_energies = exafs_variables[0].points
if xanes_energies.max() > exafs_energies.min():
logger.warning(
'The XANES `Energy` grid points are not below the EXAFS `Energy` grid points.'
Expand Down
5 changes: 4 additions & 1 deletion tests/test_permittivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def test_resolve_type(self, variables: Optional[List[Variables]], result: str):
],
)
def test_extract_absorption_spectra(
self, variables: Optional[List[Variables]], value: Optional[np.array], result
self,
variables: Optional[List[Variables]],
value: Optional[np.ndarray],
result: Optional[List[float]],
):
"""
Test the `extract_absorption_spectra` method. The `result` in the last valid case corresponds to the imaginary part of
Expand Down

0 comments on commit 7d920a4

Please sign in to comment.