Skip to content

Commit 2c2c52c

Browse files
committed
Path reference. Ruff formatting.
1 parent bd71efd commit 2c2c52c

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

benchmarks/benchmarks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from lsdb_rubin.rsp_tests.critical_functions import critical_functions
22
from lsdb_rubin.rsp_tests.random_access import random_access
3+
from pathlib import Path
34

45

56
def time_critical_functions():
@@ -17,4 +18,5 @@ def time_random_access():
1718
cause the benchmark test to fail.
1819
1920
See https://github.com/lsst-sitcom/linccf/blob/main/RSP/random_access.ipynb"""
20-
random_access(None)
21+
22+
random_access(Path(__file__).parent.parent / "tests" / "data" / "mock_dp1_1000")

docs/notebooks/plot_light_curves.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@
707707
}
708708
],
709709
"source": [
710-
"plot_light_curve(dia_object.iloc[0][\"diaSource\"], filter_linestyles=plot_linestyles_none | {\"r\":\"--\" })"
710+
"plot_light_curve(dia_object.iloc[0][\"diaSource\"], filter_linestyles=plot_linestyles_none | {\"r\": \"--\"})"
711711
]
712712
},
713713
{

docs/notebooks/tract_patch_search.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
"# Load GAIA DR3 data.\n",
5151
"\n",
5252
"gaia = lsdb.read_hats(\n",
53-
" \"https://data.lsdb.io/hats/gaia_dr3/gaia\", margin_cache=\"https://data.lsdb.io/hats/gaia_dr3/gaia_10arcs\", columns=[\"ra\", \"dec\", \"source_id\"]\n",
53+
" \"https://data.lsdb.io/hats/gaia_dr3/gaia\",\n",
54+
" margin_cache=\"https://data.lsdb.io/hats/gaia_dr3/gaia_10arcs\",\n",
55+
" columns=[\"ra\", \"dec\", \"source_id\"],\n",
5456
")\n",
5557
"gaia"
5658
]
@@ -98,10 +100,7 @@
98100
"\n",
99101
"lsdb.catalog.Catalog.tract_patch_search = tract_patch_search\n",
100102
"\n",
101-
"gaia_tract = gaia.tract_patch_search(\n",
102-
" skymap_reader=lsst_skymap,\n",
103-
" tract=tract_index\n",
104-
")\n",
103+
"gaia_tract = gaia.tract_patch_search(skymap_reader=lsst_skymap, tract=tract_index)\n",
105104
"gaia_tract"
106105
]
107106
},

src/lsdb_rubin/rsp_tests/critical_functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ def sum_id(df):
4747
### Cell 6
4848
tmp_path.cleanup()
4949

50+
5051
if __name__ == "__main__":
51-
critical_functions()
52+
critical_functions()

src/lsdb_rubin/rsp_tests/random_access.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77

88

9-
def random_access(catalog_path):
9+
def random_access(catalog_path, verbose=False):
1010
"""Run the contents of the `HATS Data Preview 1 on RSP` notebook.
1111
Any deviation from expected values will result in assertion failures.
1212
@@ -26,15 +26,18 @@ def random_access(catalog_path):
2626
partition_indices = []
2727
for percentile in [10, 50, 90]:
2828
q = np.percentile(pixel_counts, percentile)
29-
print(f"Percentile: {percentile}, Quartile: {q}")
29+
if verbose:
30+
print(f"Percentile: {percentile}, Quartile: {q}")
3031
index = int(np.argmin(np.abs(pixel_counts - q)))
3132
closest_value = pixel_counts.iloc[index]
32-
print(f"Closest value: {closest_value}, partition index: {index}")
33+
if verbose:
34+
print(f"Closest value: {closest_value}, partition index: {index}")
3335
partition_indices.append(index)
3436

3537
### Cell 4
3638
for index in partition_indices:
37-
print(f"Sampling partition {index} of size {pixel_counts.iloc[index]}")
39+
if verbose:
40+
print(f"Sampling partition {index} of size {pixel_counts.iloc[index]}")
3841
object_collection.sample(index, n=100, seed=10)
3942

4043

0 commit comments

Comments
 (0)