Data Retrieval from Citrine Database

Hi all,

I would like to kindly ask about retrieving data from Citrine. I am now following the tutorial “experiment_vs_computed_bandgap.ipynb”. I tried to use CitrineDataRetrieval but it returns an error. The retrieval code is as follows:

from matminer.data_retrieval.retrieve_Citrine import CitrineDataRetrieval
api_key = ‘xxxxxxxx’
c = CitrineDataRetrieval(api_key = api_key)
df = c.get_dataframe(prop=‘band gap’, data_type=‘EXPERIMENTAL’,
max_results=100, show_columns=[‘chemicalFormula’, ‘Band gap’])

``

The error code is:


<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-afa81122e204> in <module>()
      5
      6 df = c.get_dataframe(prop='band gap', data_type='EXPERIMENTAL',
----> 7                      max_results=100, show_columns=['chemicalFormula', 'Band gap'])
      8 df.rename(columns={'Band gap': 'Experimental band gap'}, inplace=True) # Rename column
      9 df.head()

C:\ProgramData\Anaconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py in get_dataframe(self, formula, prop, data_type, reference, min_measurement, max_measurement, from_record, data_set_id, max_results, show_columns)
     83             reference=reference, min_measurement=min_measurement,
     84             max_measurement=max_measurement, from_record=from_record,
---> 85             data_set_id=data_set_id, max_results=max_results)
     86
     87         non_prop_df = pd.DataFrame()  # df w/o measurement column

C:\ProgramData\Anaconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py in get_api_data(self, formula, prop, data_type, reference, min_measurement, max_measurement, from_record, data_set_id, max_results)
    226
    227             # Check if any results found
--> 228             if "hits" not in self.client.search(pif_query).as_dictionary():
    229                 raise KeyError("No results found!")
    230

TypeError: 'SearchClient' object is not callable

``

The package versions are as follows:

python: 3.6.5

matminer: 0.3.1

citrination-client: 4.1.0

pymatgen: 2018.5.14

Since it is a script that exists in a tutorial, I expect that others should be able to run it. Does anyone have the same problem as mine?

Thank you for your answer.

Best regards,

Peerapon

Hi Peerapon,

Thanks very much for reporting this - when I try, I see the following:

  • The latest “bleeding edge” version of matminer installed via Github gives me the error you list

  • v0.3.1 (commit id: 159516a443bf02a895247af909119cc08ab223e8) works without a problem

The change between v0.3.1 and the current repo that looks to have broken the code were updates for the new Citrine adapter. I’ve cc’ed Saurabh Bajaj at Citrine who hopefully can quickly figure out what might have gone wrong in the example notebook with the recent updates.

···

On Thu, May 17, 2018 at 8:09 AM, Peerapon Wechsuwanmanee [email protected] wrote:

Hi all,

I would like to kindly ask about retrieving data from Citrine. I am now following the tutorial “experiment_vs_computed_bandgap.ipynb”. I tried to use CitrineDataRetrieval but it returns an error. The retrieval code is as follows:

from matminer.data_retrieval.retrieve_Citrine import CitrineDataRetrieval
api_key = ‘xxxxxxxx’
c = CitrineDataRetrieval(api_key = api_key)
df = c.get_dataframe(prop=‘band gap’, data_type=‘EXPERIMENTAL’,
max_results=100, show_columns=[‘chemicalFormula’, ‘Band gap’])

``

The error code is:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-afa81122e204> in <module>()
      5
      6 df = c.get_dataframe(prop='band gap', data_type='EXPERIMENTAL',
----> 7                      max_results=100, show_columns=['chemicalFormula', 'Band gap'])
      8 df.rename(columns={'Band gap': 'Experimental band gap'}, inplace=True) # Rename column
      9 df.head()

C:\ProgramData\Anaconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py in get_dataframe(self, formula, prop, data_type, reference, min_measurement, max_measurement, from_record, data_set_id, max_results, show_columns)
     83             reference=reference, min_measurement=min_measurement,
     84             max_measurement=max_measurement, from_record=from_record,
---> 85             data_set_id=data_set_id, max_results=max_results)
     86
     87         non_prop_df = pd.DataFrame()  # df w/o measurement column

C:\ProgramData\Anaconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py in get_api_data(self, formula, prop, data_type, reference, min_measurement, max_measurement, from_record, data_set_id, max_results)
    226
    227             # Check if any results found
--> 228             if "hits" not in self.client.search(pif_query).as_dictionary():
    229                 raise KeyError("No results found!")
    230

TypeError: 'SearchClient' object is not callable

``

The package versions are as follows:

python: 3.6.5

matminer: 0.3.1

citrination-client: 4.1.0

pymatgen: 2018.5.14

Since it is a script that exists in a tutorial, I expect that others should be able to run it. Does anyone have the same problem as mine?

Thank you for your answer.

Best regards,

Peerapon

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To view this discussion on the web visit https://groups.google.com/d/msgid/matminer/350bcf6d-1674-495a-944c-73fc763b91ac%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Best,
Anubhav

Hi all,

Sorry for the delay in reply - I was on international travel and just got email access. The error you are seeing below can be resolved by updating matminer to v0.3.2, which fixes the dependency on citrination-client v4.0 and higher.

Let me know if you face any further issues

Thanks!

Saurabh

···

On Thu, May 17, 2018 at 8:09 AM, Peerapon Wechsuwanmanee [email protected] wrote:

Hi all,

I would like to kindly ask about retrieving data from Citrine. I am now following the tutorial “experiment_vs_computed_bandgap.ipynb”. I tried to use CitrineDataRetrieval but it returns an error. The retrieval code is as follows:

from matminer.data_retrieval.retrieve_Citrine import CitrineDataRetrieval
api_key = ‘xxxxxxxx’
c = CitrineDataRetrieval(api_key = api_key)
df = c.get_dataframe(prop=‘band gap’, data_type=‘EXPERIMENTAL’,
max_results=100, show_columns=[‘chemicalFormula’, ‘Band gap’])

``

The error code is:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-afa81122e204> in <module>()
      5
      6 df = c.get_dataframe(prop='band gap', data_type='EXPERIMENTAL',
----> 7                      max_results=100, show_columns=['chemicalFormula', 'Band gap'])
      8 df.rename(columns={'Band gap': 'Experimental band gap'}, inplace=True) # Rename column
      9 df.head()

C:\ProgramData\Anaconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py in get_dataframe(self, formula, prop, data_type, reference, min_measurement, max_measurement, from_record, data_set_id, max_results, show_columns)
     83             reference=reference, min_measurement=min_measurement,
     84             max_measurement=max_measurement, from_record=from_record,
---> 85             data_set_id=data_set_id, max_results=max_results)
     86
     87         non_prop_df = pd.DataFrame()  # df w/o measurement column

C:\ProgramData\Anaconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py in get_api_data(self, formula, prop, data_type, reference, min_measurement, max_measurement, from_record, data_set_id, max_results)
    226
    227             # Check if any results found
--> 228             if "hits" not in self.client.search(pif_query).as_dictionary():
    229                 raise KeyError("No results found!")
    230

TypeError: 'SearchClient' object is not callable

``

The package versions are as follows:

python: 3.6.5

matminer: 0.3.1

citrination-client: 4.1.0

pymatgen: 2018.5.14

Since it is a script that exists in a tutorial, I expect that others should be able to run it. Does anyone have the same problem as mine?

Thank you for your answer.

Best regards,

Peerapon

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To view this discussion on the web visit https://groups.google.com/d/msgid/matminer/350bcf6d-1674-495a-944c-73fc763b91ac%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Best,
Anubhav