Skip to content

Commit

Permalink
update example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
AramisDuf committed Jan 22, 2025
1 parent d9dcad4 commit 2b1fe5a
Showing 1 changed file with 27 additions and 36 deletions.
63 changes: 27 additions & 36 deletions notebooks/Aramis/load_save_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"from solardatatools import DataHandler\n",
"from solardatatools.dataio import load_redshift_data\n",
"from solardatatools.algorithms import Dilation\n",
"from spcqe.quantiles import SmoothPeriodicQuantiles"
"from spcqe.quantiles import SmoothPeriodicQuantiles\n",
"from spcqe.quantiles import save, load"
]
},
{
Expand Down Expand Up @@ -80,7 +81,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"task list: 100%|██████████████████████████████████| 7/7 [00:11<00:00, 1.69s/it]"
"task list: 100%|██████████████████████████████████| 7/7 [00:03<00:00, 1.91it/s]"
]
},
{
Expand All @@ -89,17 +90,17 @@
"text": [
"\n",
"\n",
"total time: 11.85 seconds\n",
"total time: 3.67 seconds\n",
"--------------------------------\n",
"Breakdown\n",
"--------------------------------\n",
"Preprocessing 2.00s\n",
"Cleaning 0.10s\n",
"Filtering/Summarizing 9.75s\n",
" Data quality 0.08s\n",
" Clear day detect 0.13s\n",
" Clipping detect 2.62s\n",
" Capacity change detect 6.91s\n",
"Preprocessing 0.58s\n",
"Cleaning 0.03s\n",
"Filtering/Summarizing 3.07s\n",
" Data quality 0.02s\n",
" Clear day detect 0.04s\n",
" Clipping detect 2.23s\n",
" Capacity change detect 0.78s\n",
"\n"
]
},
Expand All @@ -119,7 +120,7 @@
" }\n",
"df = load_redshift_data(**query)\n",
"dh = DataHandler(df, convert_to_ts=True)\n",
"dh.run_pipeline()"
"dh.run_pipeline(start_day_ix=918)"
]
},
{
Expand Down Expand Up @@ -152,7 +153,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|███████████████████████████████████████████| 11/11 [08:59<00:00, 49.03s/it]\n"
"100%|███████████████████████████████████████████| 11/11 [02:12<00:00, 12.05s/it]\n"
]
}
],
Expand Down Expand Up @@ -188,33 +189,16 @@
"metadata": {},
"outputs": [],
"source": [
"from spcqe.quantiles import save, load"
"save('saved_data/spq1.spq', spq)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"save('saved_data/spq.pkl', spq)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SmoothPeriodicQuantiles object has been loaded from saved_data/spq.pkl.\n"
]
}
],
"source": [
"spq2 = load('saved_data/spq.pkl')"
"spq2 = load('saved_data/spq1.spq')"
]
},
{
Expand All @@ -226,7 +210,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -657,7 +641,7 @@
" solver='qss', standing_wave=[True, False], weight=10)"
]
},
"execution_count": 11,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -675,7 +659,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand All @@ -684,14 +668,21 @@
"True"
]
},
"execution_count": 13,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.allclose(spq.fit_quantiles, spq2.fit_quantiles)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note : The object above is quite large (25 MB) because of the basis. Not saving the basis would save memory space."
]
}
],
"metadata": {
Expand Down

0 comments on commit 2b1fe5a

Please sign in to comment.