janosh / matbench-discovery

An evaluation framework for machine learning models simulating high-throughput materials discovery.
https://matbench-discovery.materialsproject.org
MIT License
90 stars 12 forks source link

2022-09-19-mp-elemental-reference-entries.json missing #17

Closed pbenner closed 1 year ago

pbenner commented 1 year ago
> python fetch_process_wbm_dataset.py 
Downloading 'wbm_summary' from https://figshare.com/ndownloader/files/40344475
Cached 'wbm_summary' to '/home/pbenner/.cache/matbench-discovery/1.0.0/wbm/2022-10-19-wbm-summary.csv'
Traceback (most recent call last):
  File "/home/pbenner/Source/tmp/matbench-discovery/data/wbm/fetch_process_wbm_dataset.py", line 25, in <module>
    from matbench_discovery.energy import get_e_form_per_atom
  File "/home/pbenner/.local/opt/anaconda3/envs/crysfeat/lib/python3.10/site-packages/matbench_discovery/energy.py", line 66, in <module>
    pd.read_json(DATA_FILES.mp_elemental_ref_entries, typ="series")
  File "/home/pbenner/.local/opt/anaconda3/envs/crysfeat/lib/python3.10/site-packages/pandas/util/_decorators.py", line 211, in wrapper
    return func(*args, **kwargs)
  File "/home/pbenner/.local/opt/anaconda3/envs/crysfeat/lib/python3.10/site-packages/pandas/util/_decorators.py", line 331, in wrapper
    return func(*args, **kwargs)
  File "/home/pbenner/.local/opt/anaconda3/envs/crysfeat/lib/python3.10/site-packages/pandas/io/json/_json.py", line 733, in read_json
    json_reader = JsonReader(
  File "/home/pbenner/.local/opt/anaconda3/envs/crysfeat/lib/python3.10/site-packages/pandas/io/json/_json.py", line 818, in __init__
    data = self._get_data_from_filepath(filepath_or_buffer)
  File "/home/pbenner/.local/opt/anaconda3/envs/crysfeat/lib/python3.10/site-packages/pandas/io/json/_json.py", line 874, in _get_data_from_filepath
    raise FileNotFoundError(f"File {filepath_or_buffer} does not exist")
FileNotFoundError: File /home/pbenner/.cache/matbench-discovery/1.0.0/mp/2022-09-19-mp-elemental-reference-entries.json does not exist

Solved this issue using:

> mkdir /home/pbenner/.cache/matbench-discovery/1.0.0/mp/
> cp ../mp/2022-09-19-mp-elemental-reference-entries.json /home/pbenner/.cache/matbench-discovery/1.0.0/mp/
janosh commented 1 year ago

Are you sure you're running the latest code? It should prompt you to download that file on the fly if it doesn't exist yet. Maybe this answer = "" if sys.stdin.isatty() else "y" doesn't work as I expect...

https://github.com/janosh/matbench-discovery/blob/3085c900dc225a9c7329ab04ca66ebed07f7248b/matbench_discovery/data.py#L204-L221

pbenner commented 1 year ago

The isatty() check is ok. The error is one line below: https://github.com/janosh/matbench-discovery/blob/0da443ffe9567b96b818f85fe7009c433432d324/matbench_discovery/data.py#L217 Instead of

        while answer not in ("y", "n", "\x1b", ""):
            answer = input(f"{msg} [y/n] ").lower().strip()

You should use

        while answer not in ("y", "n", "\x1b"):
            answer = input(f"{msg} [y/n] ").lower().strip()

With this fix, the query appears and when answering yes the file is downloaded and cached.

janosh commented 1 year ago

while answer not in ("y", "n", "\x1b"):

Oops, that was committed by accident. I'd briefly considered trying to support ESCAPE to answer "no" but then decided against and forgot to remove this.