|
70 | 70 | for prop_id, pdata in prop_models.items(): |
71 | 71 | tpl_query.update({'props': pdata['name']}) |
72 | 72 | try: |
73 | | - resp = client.get_dataframe(tpl_query) |
| 73 | + resp = client.get_dataframe(tpl_query, fields={'P': [ |
| 74 | + 'sample.material.chemical_formula', |
| 75 | + 'sample.material.phase_id', |
| 76 | + 'sample.measurement[0].property.scalar', |
| 77 | + 'sample.measurement[0].property.units', |
| 78 | + 'sample.measurement[0].condition[0].units', |
| 79 | + 'sample.measurement[0].condition[0].name', |
| 80 | + 'sample.measurement[0].condition[0].scalar' |
| 81 | + ]}, columns=['Compound', 'Phase', 'Value', 'Units', 'Cunits', 'Cname', 'Cvalue']) |
74 | 82 | except APIError as e: |
75 | 83 | prop_models[prop_id]['factual'] = None |
76 | | - if e.code != 1: |
| 84 | + if e.code != 204: |
77 | 85 | print("While checking against the MPDS an error %s occured" % e.code) |
78 | 86 | continue |
| 87 | + if prop_id not in ['m', 'd']: |
| 88 | + to_drop = resp[ |
| 89 | + (resp['Cname'] == 'Temperature') & (resp['Cunits'] == 'K') & ((resp['Cvalue'] < 200) | (resp['Cvalue'] > 400)) |
| 90 | + ] |
| 91 | + resp.drop(to_drop.index, inplace=True) |
| 92 | + if resp.empty: |
| 93 | + prop_models[prop_id]['factual'] = None |
| 94 | + continue |
79 | 95 |
|
80 | 96 | resp['Value'] = resp['Value'].astype('float64') # to treat values out of bounds given as str |
81 | 97 | resp = resp[resp['Units'] == pdata['units']] |
82 | 98 | prop_models[prop_id]['factual'] = np.median(resp['Value']) |
83 | 99 |
|
84 | 100 | for prop_id, pdata in answer['prediction'].items(): |
| 101 | + if prop_id == 't': |
| 102 | + # normalization 10**5 |
| 103 | + pdata['value'] /= 100000 |
| 104 | + pdata['mae'] /= 100000 |
| 105 | + |
85 | 106 | print("{0:40} = {1:6}, factual {2:8} (MAE = {3:4}), {4}".format( |
86 | 107 | prop_models[prop_id]['name'], |
87 | 108 | 'conductor' if pdata['value'] == 0 and prop_id == 'w' else pdata['value'], |
|
0 commit comments