Skip to content

Commit 5e77bb4

Browse files
committed
static performance output
1 parent d578947 commit 5e77bb4

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ repos:
2121
stages: [pre-commit]
2222
language: system
2323
entry: jupyter nbconvert --clear-output
24+
exclude: docs/about/performance.ipynb
2425
# Prevents committing directly branches named 'main' and 'master'.
2526
- repo: https://github.com/pre-commit/pre-commit-hooks
2627
rev: v4.4.0

docs/about/performance.ipynb

+16-32
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 1,
14+
"execution_count": null,
1515
"metadata": {},
1616
"outputs": [],
1717
"source": [
@@ -30,17 +30,9 @@
3030
},
3131
{
3232
"cell_type": "code",
33-
"execution_count": 2,
33+
"execution_count": null,
3434
"metadata": {},
35-
"outputs": [
36-
{
37-
"name": "stdout",
38-
"output_type": "stream",
39-
"text": [
40-
"494 ms ± 3.34 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
41-
]
42-
}
43-
],
35+
"outputs": [],
4436
"source": [
4537
"%%timeit\n",
4638
"\n",
@@ -50,16 +42,16 @@
5042
"\n",
5143
"# Filter on object\n",
5244
"filtered_object = object_df.query(\"ra > 10.0\")\n",
53-
"#sync object to source --removes any index values of source not found in object\n",
45+
"# sync object to source --removes any index values of source not found in object\n",
5446
"filtered_source = filtered_object[[]].join(source_df, how=\"left\")\n",
5547
"\n",
5648
"# Count number of observations per photometric band and add it to the object table\n",
57-
"band_counts = source_df.groupby(level=0).apply(lambda x: \n",
58-
" x[[\"band\"]].value_counts().reset_index()).pivot_table(values=\"count\", \n",
59-
" index=\"index\", \n",
60-
" columns=\"band\", \n",
61-
" aggfunc=\"sum\")\n",
62-
"filtered_object = filtered_object.join(band_counts[[\"g\",\"r\"]])\n",
49+
"band_counts = (\n",
50+
" source_df.groupby(level=0)\n",
51+
" .apply(lambda x: x[[\"band\"]].value_counts().reset_index())\n",
52+
" .pivot_table(values=\"count\", index=\"index\", columns=\"band\", aggfunc=\"sum\")\n",
53+
")\n",
54+
"filtered_object = filtered_object.join(band_counts[[\"g\", \"r\"]])\n",
6355
"\n",
6456
"# Filter on our nobs\n",
6557
"filtered_object = filtered_object.query(\"g > 520\")\n",
@@ -81,28 +73,20 @@
8173
"cell_type": "code",
8274
"execution_count": null,
8375
"metadata": {},
84-
"outputs": [
85-
{
86-
"name": "stdout",
87-
"output_type": "stream",
88-
"text": [
89-
"230 ms ± 2.81 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
90-
]
91-
}
92-
],
76+
"outputs": [],
9377
"source": [
9478
"%%timeit\n",
9579
"\n",
96-
"#Read in parquet data\n",
97-
"#nesting sources into objects\n",
98-
"nf = npd.read_parquet(data=\"objects.parquet\",\n",
99-
" to_pack={\"ztf_sources\": \"ztf_sources.parquet\"})\n",
80+
"# Read in parquet data\n",
81+
"# nesting sources into objects\n",
82+
"nf = npd.read_parquet(data=\"objects.parquet\", to_pack={\"ztf_sources\": \"ztf_sources.parquet\"})\n",
10083
"\n",
10184
"# Filter on object\n",
10285
"nf = nf.query(\"ra > 10.0\")\n",
10386
"\n",
10487
"# Count number of observations per photometric band and add it as a column\n",
105-
"from nested_pandas.utils import count_nested # utility function of nested_pandas\n",
88+
"from nested_pandas.utils import count_nested # utility function of nested_pandas\n",
89+
"\n",
10690
"nf = count_nested(nf, \"ztf_sources\", by=\"band\", join=True)\n",
10791
"\n",
10892
"# Filter on our nobs\n",

0 commit comments

Comments
 (0)