|
29 | 29 | "outputs": [], |
30 | 30 | "execution_count": 5 |
31 | 31 | }, |
| 32 | + { |
| 33 | + "metadata": {}, |
| 34 | + "cell_type": "code", |
| 35 | + "outputs": [], |
| 36 | + "execution_count": null, |
| 37 | + "source": [ |
| 38 | + "# get the JSON data file generated from the instance\n", |
| 39 | + "data_files = ips_analysis_api.get_data()" |
| 40 | + ], |
| 41 | + "id": "fc9bfad1db6fe246" |
| 42 | + }, |
| 43 | + { |
| 44 | + "metadata": {}, |
| 45 | + "cell_type": "code", |
| 46 | + "outputs": [], |
| 47 | + "execution_count": null, |
| 48 | + "source": [ |
| 49 | + "# echo what we got for a sanity check\n", |
| 50 | + "data_files" |
| 51 | + ], |
| 52 | + "id": "8f9fac74f66daa6b" |
| 53 | + }, |
| 54 | + { |
| 55 | + "metadata": {}, |
| 56 | + "cell_type": "code", |
| 57 | + "outputs": [], |
| 58 | + "execution_count": null, |
| 59 | + "source": [ |
| 60 | + "for file in data_files[0.0]:\n", |
| 61 | + " if file.endswith('_solution.json'):\n", |
| 62 | + " solution_json_file = file\n", |
| 63 | + " break\n", |
| 64 | + "else:\n", |
| 65 | + " print('JSON solution file for this ensemble is missing')" |
| 66 | + ], |
| 67 | + "id": "c0883abd61aa1b18" |
| 68 | + }, |
32 | 69 | { |
33 | 70 | "metadata": { |
34 | 71 | "ExecuteTime": { |
|
38 | 75 | }, |
39 | 76 | "cell_type": "code", |
40 | 77 | "source": [ |
41 | | - "# Find the JSON output from `gen_data.py` that was invoked as a sub-task. It will\n", |
42 | | - "# follow the naming pattern `<instance ID>_solution.json`. It will contain two\n", |
43 | | - "# arrays, `x` and `u`, which we will plot.\n", |
44 | | - "solution_json_file = list(Path(\"..\").rglob(\"*solution.json\"))\n", |
45 | | - "\n", |
46 | | - "if len(solution_json_file) != 1:\n", |
47 | | - " raise RuntimeError(\n", |
48 | | - " f\"Expected exactly one solution JSON file, found {len(solution_json_file)}\"\n", |
49 | | - " )\n", |
50 | | - "solution_json_file = solution_json_file[0]\n", |
51 | | - "\n", |
52 | 78 | "# Now read the JSON file and extract the data.\n", |
53 | 79 | "with open(solution_json_file, \"r\") as f:\n", |
54 | 80 | " solution_data = json.load(f)\n", |
|
0 commit comments