Error in obtaining XANES spectra for iron K-edge

Hello, I got an error trying to give the command

MPRester(API_KEY).xas.search(absorbing_element='Fe', edge=Edge.K)`

I correctly imported what was required, with

from mp_api .client import MPRester
from emmet.core.xas import Edge, Type

My intention is to get the existing spectra with these settings, the error I got is the following:

ValueError                                Traceback (most recent call last)
Cell In[4], line 1
----> 1 MPRester(API_KEY).xas.search(absorbing_element='Fe', edge=Edge.K)
      2 #ValueError: Double check the intensities. Most of them are non-positive.

File c:\Users\user\.conda\envs\pepepy\Lib\site-packages\mp_api\client\routes\materials\xas.py:101, in XASRester.search(self, edge, absorbing_element, formula, chemsys, elements, material_ids, spectrum_type, sort_fields, num_chunks, chunk_size, all_fields, fields)

File c:\Users\user\.conda\envs\pepepy\Lib\site-packages\pymatgen\analysis\xas\spectrum.py:85, in XAS.__init__(self, x, y, structure, absorbing_element, edge, spectrum_type, absorbing_index)
     83 # check for empty spectra and negative intensities
     84 if sum(1 for i in self.y if i <= 0) / len(self.y) > 0.05:
---> 85     raise ValueError("Double check the intensities. Most of them are non-positive.")

ValueError: Double check the intensities. Most of them are non-positive."
``

Can someone help me? Thanks!

@PedroSophiaaa, this look like it may be an incompatibility with some of the XAS data currently in the database, and some changes that have been made in pymatgen. The issue here is in the de-serialization of the objects.

I am taking a closer look at this. For now, you can still access the data by passing monty_decode=False, use_document_model=False to MPRester alongside your API key. This will force the API to just return the raw data in a dictionary.

– Jason