Skip to content

Commit 927aa85

Browse files
committed
Fixup linter
1 parent bd5869e commit 927aa85

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

docs/notebooks/nested_pandas_time_series_with_hyrax.ipynb

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"import hyrax\n",
2525
"\n",
2626
"rng = np.random.default_rng(42)\n",
27-
"output_path = Path('./random_lightcurve.parquet')\n",
27+
"output_path = Path(\"./random_lightcurve.parquet\")\n",
2828
"\n",
2929
"n_objects = 10\n",
3030
"n_points = 64\n",
@@ -39,12 +39,12 @@
3939
" band = rng.choice([0, 1, 2], size=n_points)\n",
4040
" rows.append(\n",
4141
" {\n",
42-
" 'object_id': f'obj-{idx:04d}',\n",
43-
" 'lightcurve': {\n",
44-
" 'time': times.tolist(),\n",
45-
" 'flux': flux.tolist(),\n",
46-
" 'flux_err': flux_err.tolist(),\n",
47-
" 'band': band.tolist(),\n",
42+
" \"object_id\": f\"obj-{idx:04d}\",\n",
43+
" \"lightcurve\": {\n",
44+
" \"time\": times.tolist(),\n",
45+
" \"flux\": flux.tolist(),\n",
46+
" \"flux_err\": flux_err.tolist(),\n",
47+
" \"band\": band.tolist(),\n",
4848
" },\n",
4949
" }\n",
5050
" )\n",
@@ -53,20 +53,20 @@
5353
"pq.write_table(table, output_path)\n",
5454
"\n",
5555
"h = hyrax.Hyrax()\n",
56-
"h.config['data_request'] = {\n",
57-
" 'infer': {\n",
58-
" 'lc': {\n",
59-
" 'dataset_class': 'NestedPandasDataset',\n",
60-
" 'data_location': str(output_path),\n",
61-
" 'primary_id_field': 'object_id',\n",
56+
"h.config[\"data_request\"] = {\n",
57+
" \"infer\": {\n",
58+
" \"lc\": {\n",
59+
" \"dataset_class\": \"NestedPandasDataset\",\n",
60+
" \"data_location\": str(output_path),\n",
61+
" \"primary_id_field\": \"object_id\",\n",
6262
" # Request only nested columns using nested-pandas dot-notation.\n",
63-
" 'fields': ['lightcurve.time', 'lightcurve.flux', 'lightcurve.flux_err', 'lightcurve.band'],\n",
63+
" \"fields\": [\"lightcurve.time\", \"lightcurve.flux\", \"lightcurve.flux_err\", \"lightcurve.band\"],\n",
6464
" }\n",
6565
" }\n",
6666
"}\n",
6767
"\n",
6868
"prepared = h.prepare()\n",
69-
"print(f'Loaded rows: {len(prepared[\"infer\"])}')"
69+
"print(f\"Loaded rows: {len(prepared['infer'])}\")"
7070
]
7171
},
7272
{
@@ -84,7 +84,7 @@
8484
"metadata": {},
8585
"outputs": [],
8686
"source": [
87-
"prepared['infer'][0]['lc'].keys()"
87+
"prepared[\"infer\"][0][\"lc\"].keys()"
8888
]
8989
},
9090
{
@@ -94,7 +94,7 @@
9494
"metadata": {},
9595
"outputs": [],
9696
"source": [
97-
"prepared['infer'][0]['lc']['lightcurve.time'][:5], prepared['infer'][0]['lc']['lightcurve.flux'][:5]"
97+
"prepared[\"infer\"][0][\"lc\"][\"lightcurve.time\"][:5], prepared[\"infer\"][0][\"lc\"][\"lightcurve.flux\"][:5]"
9898
]
9999
},
100100
{
@@ -107,19 +107,19 @@
107107
"import matplotlib.pyplot as plt\n",
108108
"import numpy as np\n",
109109
"\n",
110-
"time = np.asarray(prepared['infer'][0]['lc']['lightcurve.time'])\n",
111-
"flux = np.asarray(prepared['infer'][0]['lc']['lightcurve.flux'])\n",
112-
"flux_err = np.asarray(prepared['infer'][0]['lc']['lightcurve.flux_err'])\n",
113-
"band = np.asarray(prepared['infer'][0]['lc']['lightcurve.band'])\n",
110+
"time = np.asarray(prepared[\"infer\"][0][\"lc\"][\"lightcurve.time\"])\n",
111+
"flux = np.asarray(prepared[\"infer\"][0][\"lc\"][\"lightcurve.flux\"])\n",
112+
"flux_err = np.asarray(prepared[\"infer\"][0][\"lc\"][\"lightcurve.flux_err\"])\n",
113+
"band = np.asarray(prepared[\"infer\"][0][\"lc\"][\"lightcurve.band\"])\n",
114114
"\n",
115115
"plt.figure(figsize=(10, 5))\n",
116116
"for b in np.unique(band):\n",
117117
" m = band == b\n",
118-
" plt.errorbar(time[m], flux[m], flux_err[m], fmt='o', label=f'band {b}', alpha=0.8)\n",
118+
" plt.errorbar(time[m], flux[m], flux_err[m], fmt=\"o\", label=f\"band {b}\", alpha=0.8)\n",
119119
"\n",
120-
"plt.xlabel('MJD')\n",
121-
"plt.ylabel('Flux')\n",
122-
"plt.grid(True, which='both', linestyle='--', linewidth=0.5)\n",
120+
"plt.xlabel(\"MJD\")\n",
121+
"plt.ylabel(\"Flux\")\n",
122+
"plt.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5)\n",
123123
"plt.legend()\n",
124124
"plt.show()"
125125
]

0 commit comments

Comments
 (0)