From 9f15fa128663c15d58cfce28ec7326645d4b548b Mon Sep 17 00:00:00 2001 From: Colin Orion Chandler Date: Mon, 5 Feb 2024 13:14:18 -0800 Subject: [PATCH] Creating a structure for scratch notebooks Brainstorming, demos, and testing to share. --- .../coc/RegionSearchTesting.ipynb | 944 ++++++++++++++++++ 1 file changed, 944 insertions(+) create mode 100644 notebooks/region_search/coc/RegionSearchTesting.ipynb diff --git a/notebooks/region_search/coc/RegionSearchTesting.ipynb b/notebooks/region_search/coc/RegionSearchTesting.ipynb new file mode 100644 index 00000000..acb32c51 --- /dev/null +++ b/notebooks/region_search/coc/RegionSearchTesting.ipynb @@ -0,0 +1,944 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "ab967f8a-b2eb-4af9-9b28-3552c80f2801", + "metadata": {}, + "outputs": [], + "source": [ + "# NOTE: must do this before launching Jupyter Notebook!\n", + "# (1) source setupLSST.zsh\n", + "# (2) run the demodata/pipeline_check setup -r .\n", + "# (3) run the setup -r . for rc2_subset" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "71fb6969-878e-48d3-901b-47468694bfbb", + "metadata": {}, + "outputs": [], + "source": [ + "from lsst.daf.butler import Butler\n", + "import os\n", + "import time\n", + "from lsst import sphgeom" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "2c3dcb5d-8bf6-4073-b332-70342da9a847", + "metadata": {}, + "outputs": [], + "source": [ + "repo_path = os.path.join(os.environ['RC2_SUBSET_DIR'], 'SMALL_HSC')\n", + "butler = Butler(repo_path)\n", + "registry = butler.registry\n", + "#collection = f\"u/{os.environ['USER']}/single_frame\"\n", + "#d = butler.registry.queryDatasets('calexp', physical_filter='HSC-R', collections=collection, instrument='HSC')\n", + "#calexp = butler.get('calexp', visit=23718, detector=41, collections=collection, instrument='HSC')\n", + "# calexp.visitInfo.boresightRaDec\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "2f94e6a3-d7b4-45b0-9ba5-6a784559f604", + "metadata": {}, + "outputs": [], + "source": [ + "collection = f\"u/{os.environ['USER']}/single_frame\"\n", + "#vdr = butler.registry.queryDimensionRecords(\"visit_detector_region\")\n", + "#vdr = butler.registry.queryDimensionRecords(\"visit_detector_region\", collections=collection)\n", + "vdr = butler.registry.queryDimensionRecords(\"visit_detector_region\", datasets='calexp', collections=collection, instrument='HSC', physical_filter='HSC-R') # more specific, just the calex stuff" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "3c65104b-fd14-4344-9b62-7c4eea2485d5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First VDR record:\n", + "{instrument: 'HSC', detector: 41, visit: 1204}\n", + "ConvexPolygon([UnitVector3d(-0.8685370178854345, 0.49439163180184836, 0.03493369386397754), UnitVector3d(-0.8684746456459038, 0.4943508977169074, 0.036999726981556666), UnitVector3d(-0.8665881263897214, 0.4976505625849847, 0.036999145384733166), UnitVector3d(-0.8666527966506773, 0.4976875474603122, 0.03492900171060283)])\n" + ] + } + ], + "source": [ + "print(f'First VDR record:')\n", + "for i in vdr:\n", + " first_vdr_rec = i\n", + " break\n", + "print(first_vdr_rec.dataId) # {instrument: 'HSC', detector: 41, visit: 1204}\n", + "print(first_vdr_rec.region) # ConvexPolygon([UnitVector3d(-0.8685370178854345, 0.49439163180184836, 0.03493369386397754), UnitVector3d(-0.8684746456459038, 0.4943508977169074, 0.036999726981556666), UnitVector3d(-0.8665881263897214, 0.4976505625849847, 0.036999145384733166), UnitVector3d(-0.8666527966506773, 0.4976875474603122, 0.03492900171060283)])\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "83e23099-2e0f-4e35-81c3-c64b05e77a24", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "9ce47103-6350-47b0-a91d-369180706388", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Last VDR record:\n", + "{instrument: 'HSC', detector: 58, visit: 23718}\n", + "ConvexPolygon([UnitVector3d(-0.8652234119418918, 0.49972867464192744, 0.04073940559524716), UnitVector3d(-0.8652923227482628, 0.4997734451226977, 0.03867427753825506), UnitVector3d(-0.8671859739320048, 0.49648028531881305, 0.03867574052749735), UnitVector3d(-0.8671146883772648, 0.4964392228880602, 0.04074573816606947)])\n" + ] + } + ], + "source": [ + "print(f'Last VDR record:')\n", + "for i in vdr:\n", + " last_vdr_rec = i\n", + "print(last_vdr_rec.dataId) # {instrument: 'HSC', detector: 58, visit: 23718}\n", + "print(last_vdr_rec.region) # ConvexPolygon([UnitVector3d(-0.8652234119418918, 0.49972867464192744, 0.04073940559524716), UnitVector3d(-0.8652923227482628, 0.4997734451226977, 0.03867427753825506), UnitVector3d(-0.8671859739320048, 0.49648028531881305, 0.03867574052749735), UnitVector3d(-0.8671146883772648, 0.4964392228880602, 0.04074573816606947)])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "5894c666-be1b-474e-86b4-0f16009b0415", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "first_vdr_rec.region.contains(first_vdr_rec.region) = True\n", + "first_vdr_rec.region.contains(last_vdr_rec.region) = False\n" + ] + } + ], + "source": [ + "# silly test first\n", + "print(f'first_vdr_rec.region.contains(first_vdr_rec.region) = {first_vdr_rec.region.contains(first_vdr_rec.region)}') # should be True!!\n", + "print(f'first_vdr_rec.region.contains(last_vdr_rec.region) = {first_vdr_rec.region.contains(last_vdr_rec.region)}') # False\n" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "060b973b-5591-42ba-ae65-5bf1e4c4f825", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Checking matches of first_vdr.region against all records region for matchces...\n", + "There were 1 matches:\n", + "{instrument: 'HSC', detector: 41, visit: 1204}\n" + ] + } + ], + "source": [ + "print(f'Checking matches of first_vdr.region against all records region for matchces...')\n", + "matches = []\n", + "for vdr_rec in vdr:\n", + " if vdr_rec.region.contains(first_vdr_rec.region):\n", + " matches.append(vdr_rec.dataId)\n", + "print(f'There were {len(matches)} matches:')\n", + "for i in matches: print(i)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "507ce759-1e30-4be7-ac44-fbc434d8e753", + "metadata": {}, + "outputs": [], + "source": [ + "# TODO: find all corners, and double-check the overlap 11/16/2023 COC\n", + "# HSC/calib/gen2/20180117\n" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "09020453-1b37-4538-9aaf-a725bc979858", + "metadata": {}, + "outputs": [], + "source": [ + "#datasetRefs = registry.queryDatasets(datasetType='calexp', collections='HSC/calib/gen2/20180117')\n" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "1e34d83b-eb07-4e2d-961c-8e9e47355ab2", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "calexp@{instrument: 'HSC', detector: 41, visit: 1204, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=4d673e07-c749-4d80-9dcf-b39615a802a4)\n", + "calexp@{instrument: 'HSC', detector: 41, visit: 1206, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=9f3ea177-6daa-4e00-9bcb-8b0616c9b855)\n", + "calexp@{instrument: 'HSC', detector: 41, visit: 1214, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=b3965daf-39b4-43f1-a1ac-49f6dd399c6f)\n", + "calexp@{instrument: 'HSC', detector: 41, visit: 1220, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=b65a71c7-6c0f-476d-9c52-4c93e4d8b12a)\n", + "calexp@{instrument: 'HSC', detector: 41, visit: 23694, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=bef09c5b-3fb5-49c2-80d1-327bc1120fd2)\n", + "calexp@{instrument: 'HSC', detector: 41, visit: 23704, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=f061d55c-64a5-4d74-8ce2-3eb822c6ffbd)\n", + "calexp@{instrument: 'HSC', detector: 41, visit: 23706, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=4a509cbe-f46a-46e6-85bc-f3274dd59524)\n", + "calexp@{instrument: 'HSC', detector: 41, visit: 23718, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=91b1f763-f776-42f4-a474-5ff3492acc0b)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 1204, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=87055aa3-9e11-4d64-b2ed-e0233c24c403)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 1206, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=5b87e4f6-5a95-4a3b-af93-22c4b8c0e6e0)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 1214, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=945468ce-3d0e-4030-b823-dd1d5a532876)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 1220, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=9d42d8cd-a07b-4b1e-b0d8-79666a1464b9)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 23694, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=df6a6120-72d3-43b0-b392-a83fdaf69398)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 23704, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=096f41bd-4216-4424-9681-104fde395d2c)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 23706, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=aa208f29-6d2f-4d78-b940-3250c7c50fb7)\n", + "calexp@{instrument: 'HSC', detector: 42, visit: 23718, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=733f733e-6a8d-4125-89fd-45624e8c71bc)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 1204, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=07536c48-b4c8-4c32-961f-b6261015d417)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 1206, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=de2250b1-920a-47ff-bf17-41ee4bcdbb2c)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 1214, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=7f2fc43c-ae5c-434e-b738-d58677e028a1)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 1220, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=9140c30b-654e-4f46-9cfe-56ce57877d5d)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 23694, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=022f049f-7369-4514-9372-dbfd2fa764ef)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 23704, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=4aa4a48b-35d9-4979-a33a-7355c032942e)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 23706, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=56320e78-6121-4047-913a-6fe064cd16ab)\n", + "calexp@{instrument: 'HSC', detector: 47, visit: 23718, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=596b32cb-5e35-4257-b9c7-2b45fc36630f)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 1204, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=53963b41-b927-461d-bf0e-5986a0471ecb)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 1206, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=f66b0a47-4135-4fd7-a317-da8a8d1d6170)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 1214, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=e8774d73-3efa-4076-bac8-b84a59f6605b)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 1220, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=ae7dde19-9233-42ef-8f91-e6428511d660)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 23694, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=6b05023d-86cf-4e77-a9a8-7d8591fc195c)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 23704, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=199133f5-8823-4458-a20a-0dbfaa2bbc3e)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 23706, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=05e57fc0-4ef1-46f5-bb62-38a08b1c4201)\n", + "calexp@{instrument: 'HSC', detector: 49, visit: 23718, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=b24c2672-2512-4e65-9740-74022802f82c)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 1204, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=81e47e75-83c4-4341-9a07-c35a6cb38a9a)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 1206, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=2c3d592f-9bba-48e3-abac-80fc92a7283a)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 1214, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=4978031c-4bde-4f2f-ba4c-8069e4afac53)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 1220, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=064a52d4-68b1-4d12-b3e8-65fa945cb518)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 23694, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=a3e09cb0-3304-4a6b-9e5a-251b96c857c5)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 23704, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=b7bca4ff-a559-4f7f-9691-3b86368dbf28)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 23706, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=aa1ff092-2bd7-4d62-873d-5e5f82717b22)\n", + "calexp@{instrument: 'HSC', detector: 50, visit: 23718, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=c7b5bc6d-0991-494b-921b-76a0e9b7f2d3)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 1204, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=151a35cb-b254-4474-84d6-5c3004fe56c9)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 1206, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=1a827f6f-c666-4edd-88a5-0002524485b7)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 1214, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=51f76937-7f49-4157-aae7-fed4281e46a8)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 1220, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=1015b0f9-3470-4ab7-9dfa-729a9888db29)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 23694, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=f4256be0-f277-4a16-b656-5294017cd9a4)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 23704, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=010d7808-855d-4f6b-80ec-49bc460d8a6f)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 23706, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=b5fcbe18-caf0-4e6b-810d-b9c79a7cba16)\n", + "calexp@{instrument: 'HSC', detector: 58, visit: 23718, ...} [sc=ExposureF] (run=u/colinchandler/single_frame/20231110T234552Z id=784f36f1-98f3-4ecd-b35e-7bd04cecbdb7)\n" + ] + } + ], + "source": [ + "# using collection = f\"u/{os.environ['USER']}/single_frame\"\n", + "for ref in butler.registry.queryDatasets('calexp', physical_filter='HSC-R', collections=collection, instrument='HSC'):\n", + "\tprint(ref)\n", + "\n", + "for ref in butler.registry.queryDatasets('calexp', physical_filter='HSC-R', collections=collection, instrument='HSC'):\n", + "\tfirst_dsr = ref\n", + "\tbreak\n" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "4351a801-39e1-405b-8d5c-add0da0933be", + "metadata": {}, + "outputs": [], + "source": [ + "# TODO do an example that spans filters and demonstrates .contains(), and also the one we have below with .intersects(). \n" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "eddd8177-8447-4f6c-92aa-f793351b3b2a", + "metadata": {}, + "outputs": [], + "source": [ + "#all_ds = [ ds for ds in registry.queryDatasets('calexp',collections=collection, instrument='HSC, physical_filter='HSC-R')]\n", + "# lol now it's the same as above. Result count this way is 48. Removing physical_filter and instrument results in 240.\n", + "# NOTE: there are 48 in the directory structure, as so from bash:\n", + "# find /Users/colinchandler/lsst_stack_w_2023_44/rc2_subset/SMALL_HSC/u/colinchandler/single_frame/20231110T234552Z/calexp -name \\*HSC-R\\*.fits\n" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "8dc71a26-ca04-476d-8580-7862f8d4f79d", + "metadata": {}, + "outputs": [], + "source": [ + "dsq = registry.queryDatasets('calexp',collections=collection, instrument='HSC', physical_filter='HSC-R')\n", + "dsrecords = [i for i in dsq] # 12/20/2023 COC\n", + "dataIds = [i.dataId for i in dsq]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "id": "550bfd1a-c129-4e8e-812b-18dc5a5ff543", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{band: 'r', instrument: 'HSC', detector: 41, physical_filter: 'HSC-R', visit_system: 0, visit: 1204}" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dataIds[0].full" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "id": "bcf75eb3-0fd1-4327-a94d-aab20ac7bf98", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "DatasetRef(DatasetType('calexp', {band, instrument, detector, physical_filter, visit_system, visit}, ExposureF), {instrument: 'HSC', detector: 41, visit: 1204, ...}, run='u/colinchandler/single_frame/20231110T234552Z', id=4d673e07-c749-4d80-9dcf-b39615a802a4)" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dsrecords[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "id": "54f4ea99-6799-45b8-9dc5-3f12e1994fd6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "UUID('4d673e07-c749-4d80-9dcf-b39615a802a4')" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# here we get unique IDs back from the butler 12/20/2023 COC\n", + "testid = dsrecords[0].id\n", + "testid" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "id": "b2258648-8939-4607-a408-331bc731f618", + "metadata": {}, + "outputs": [ + { + "ename": "UserExpressionSyntaxError", + "evalue": "Failed to parse user expression 'id=4d673e07-c749-4d80-9dcf-b39615a802a4'.", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mParseError\u001b[0m Traceback (most recent call last)", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/expressions/_predicate.py:136\u001b[0m, in \u001b[0;36mmake_string_expression_predicate\u001b[0;34m(string, dimensions, column_types, bind, data_id, defaults, dataset_type_name, allow_orphans)\u001b[0m\n\u001b[1;32m 135\u001b[0m parser \u001b[38;5;241m=\u001b[39m ParserYacc()\n\u001b[0;32m--> 136\u001b[0m tree \u001b[38;5;241m=\u001b[39m \u001b[43mparser\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstring\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 137\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/expressions/parser/parserYacc.py:270\u001b[0m, in \u001b[0;36mParserYacc.parse\u001b[0;34m(self, input, lexer, debug, tracking)\u001b[0m\n\u001b[1;32m 269\u001b[0m lexer \u001b[38;5;241m=\u001b[39m ParserLex\u001b[38;5;241m.\u001b[39mmake_lexer()\n\u001b[0;32m--> 270\u001b[0m tree \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparser\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlexer\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdebug\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdebug\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtracking\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtracking\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m tree\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/expressions/parser/ply/yacc.py:349\u001b[0m, in \u001b[0;36mLRParser.parse\u001b[0;34m(self, input, lexer, debug, tracking, tokenfunc)\u001b[0m\n\u001b[1;32m 348\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 349\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparseopt_notrack\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdebug\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtracking\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtokenfunc\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/expressions/parser/ply/yacc.py:1214\u001b[0m, in \u001b[0;36mLRParser.parseopt_notrack\u001b[0;34m(self, input, lexer, debug, tracking, tokenfunc)\u001b[0m\n\u001b[1;32m 1213\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstate \u001b[38;5;241m=\u001b[39m state\n\u001b[0;32m-> 1214\u001b[0m tok \u001b[38;5;241m=\u001b[39m \u001b[43mcall_errorfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43merrorfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrtoken\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1215\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39merrorok:\n\u001b[1;32m 1216\u001b[0m \u001b[38;5;66;03m# User must have done some kind of panic\u001b[39;00m\n\u001b[1;32m 1217\u001b[0m \u001b[38;5;66;03m# mode recovery on their own. The\u001b[39;00m\n\u001b[1;32m 1218\u001b[0m \u001b[38;5;66;03m# returned token is the next lookahead\u001b[39;00m\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/expressions/parser/ply/yacc.py:202\u001b[0m, in \u001b[0;36mcall_errorfunc\u001b[0;34m(errorfunc, token, parser)\u001b[0m\n\u001b[1;32m 201\u001b[0m _restart \u001b[38;5;241m=\u001b[39m parser\u001b[38;5;241m.\u001b[39mrestart\n\u001b[0;32m--> 202\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43merrorfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtoken\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/expressions/parser/parserYacc.py:450\u001b[0m, in \u001b[0;36mParserYacc.p_error\u001b[0;34m(self, p)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 450\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ParseError(p\u001b[38;5;241m.\u001b[39mlexer\u001b[38;5;241m.\u001b[39mlexdata, p\u001b[38;5;241m.\u001b[39mvalue, p\u001b[38;5;241m.\u001b[39mlexpos, p\u001b[38;5;241m.\u001b[39mlineno)\n", + "\u001b[0;31mParseError\u001b[0m: Syntax error at or near 'd673e07' (line: 1, pos: 5)", + "\nThe above exception was the direct cause of the following exception:\n", + "\u001b[0;31mUserExpressionSyntaxError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[63], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m bulteridtest \u001b[38;5;241m=\u001b[39m \u001b[43mregistry\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mqueryDatasets\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcalexp\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcollections\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mwhere\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mid=\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mtestid\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/_registry_shim.py:312\u001b[0m, in \u001b[0;36mRegistryShim.queryDatasets\u001b[0;34m(self, datasetType, collections, dimensions, dataId, where, findFirst, components, bind, check, **kwargs)\u001b[0m\n\u001b[1;32m 297\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mqueryDatasets\u001b[39m(\n\u001b[1;32m 298\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 299\u001b[0m datasetType: Any,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 310\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m DatasetQueryResults:\n\u001b[1;32m 311\u001b[0m \u001b[38;5;66;03m# Docstring inherited from a base class.\u001b[39;00m\n\u001b[0;32m--> 312\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_registry\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mqueryDatasets\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 313\u001b[0m \u001b[43m \u001b[49m\u001b[43mdatasetType\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 314\u001b[0m \u001b[43m \u001b[49m\u001b[43mcollections\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollections\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 315\u001b[0m \u001b[43m \u001b[49m\u001b[43mdimensions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdimensions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 316\u001b[0m \u001b[43m \u001b[49m\u001b[43mdataId\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdataId\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 317\u001b[0m \u001b[43m \u001b[49m\u001b[43mwhere\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mwhere\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 318\u001b[0m \u001b[43m \u001b[49m\u001b[43mfindFirst\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfindFirst\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 319\u001b[0m \u001b[43m \u001b[49m\u001b[43mcomponents\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcomponents\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 320\u001b[0m \u001b[43m \u001b[49m\u001b[43mbind\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbind\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 321\u001b[0m \u001b[43m \u001b[49m\u001b[43mcheck\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 322\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 323\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/sql_registry.py:2097\u001b[0m, in \u001b[0;36mSqlRegistry.queryDatasets\u001b[0;34m(self, datasetType, collections, dimensions, dataId, where, findFirst, components, bind, check, **kwargs)\u001b[0m\n\u001b[1;32m 2094\u001b[0m dimension_names\u001b[38;5;241m.\u001b[39mupdate(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdimensions\u001b[38;5;241m.\u001b[39mextract(dimensions)\u001b[38;5;241m.\u001b[39mnames)\n\u001b[1;32m 2095\u001b[0m \u001b[38;5;66;03m# Construct the summary structure needed to construct a\u001b[39;00m\n\u001b[1;32m 2096\u001b[0m \u001b[38;5;66;03m# QueryBuilder.\u001b[39;00m\n\u001b[0;32m-> 2097\u001b[0m summary \u001b[38;5;241m=\u001b[39m \u001b[43mqueries\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mQuerySummary\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2098\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequested\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mDimensionGraph\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdimensions\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnames\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdimension_names\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2099\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolumn_types\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_managers\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcolumn_types\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2100\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2101\u001b[0m \u001b[43m \u001b[49m\u001b[43mexpression\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mwhere\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2102\u001b[0m \u001b[43m \u001b[49m\u001b[43mbind\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbind\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2103\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefaults\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdefaults\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdataId\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2104\u001b[0m \u001b[43m \u001b[49m\u001b[43mcheck\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2105\u001b[0m \u001b[43m \u001b[49m\u001b[43mdatasets\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43mparent_dataset_type\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2106\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2107\u001b[0m builder \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_makeQueryBuilder(summary)\n\u001b[1;32m 2108\u001b[0m \u001b[38;5;66;03m# Add the dataset subquery to the query, telling the QueryBuilder\u001b[39;00m\n\u001b[1;32m 2109\u001b[0m \u001b[38;5;66;03m# to include the rank of the selected collection in the results\u001b[39;00m\n\u001b[1;32m 2110\u001b[0m \u001b[38;5;66;03m# only if we need to findFirst. Note that if any of the\u001b[39;00m\n\u001b[1;32m 2111\u001b[0m \u001b[38;5;66;03m# collections are actually wildcard expressions, and\u001b[39;00m\n\u001b[1;32m 2112\u001b[0m \u001b[38;5;66;03m# findFirst=True, this will raise TypeError for us.\u001b[39;00m\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/_structs.py:384\u001b[0m, in \u001b[0;36mQuerySummary.__init__\u001b[0;34m(self, requested, column_types, data_id, expression, region, bind, defaults, datasets, order_by, limit, check)\u001b[0m\n\u001b[1;32m 382\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 383\u001b[0m dataset_type_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 384\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mwhere \u001b[38;5;241m=\u001b[39m \u001b[43mQueryWhereClause\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcombine\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 385\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequested\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 386\u001b[0m \u001b[43m \u001b[49m\u001b[43mexpression\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexpression\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 387\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolumn_types\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolumn_types\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 388\u001b[0m \u001b[43m \u001b[49m\u001b[43mbind\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbind\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 389\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 390\u001b[0m \u001b[43m \u001b[49m\u001b[43mregion\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mregion\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 391\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefaults\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdefaults\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 392\u001b[0m \u001b[43m \u001b[49m\u001b[43mdataset_type_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdataset_type_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 393\u001b[0m \u001b[43m \u001b[49m\u001b[43mallow_orphans\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;129;43;01mnot\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mcheck\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 394\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 395\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39morder_by \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01mif\u001b[39;00m order_by \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m OrderByClause\u001b[38;5;241m.\u001b[39mparse_general(order_by, requested)\n\u001b[1;32m 396\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlimit \u001b[38;5;241m=\u001b[39m limit\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/_structs.py:114\u001b[0m, in \u001b[0;36mQueryWhereClause.combine\u001b[0;34m(cls, dimensions, expression, column_types, bind, data_id, region, defaults, dataset_type_name, allow_orphans)\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m defaults \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 113\u001b[0m defaults \u001b[38;5;241m=\u001b[39m DataCoordinate\u001b[38;5;241m.\u001b[39mmakeEmpty(dimensions\u001b[38;5;241m.\u001b[39muniverse)\n\u001b[0;32m--> 114\u001b[0m expression_predicate, governor_constraints \u001b[38;5;241m=\u001b[39m \u001b[43mmake_string_expression_predicate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 115\u001b[0m \u001b[43m \u001b[49m\u001b[43mexpression\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 116\u001b[0m \u001b[43m \u001b[49m\u001b[43mdimensions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 117\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolumn_types\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolumn_types\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 118\u001b[0m \u001b[43m \u001b[49m\u001b[43mbind\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbind\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 119\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 120\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefaults\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdefaults\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 121\u001b[0m \u001b[43m \u001b[49m\u001b[43mdataset_type_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdataset_type_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 122\u001b[0m \u001b[43m \u001b[49m\u001b[43mallow_orphans\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mallow_orphans\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 123\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 124\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m QueryWhereClause(\n\u001b[1;32m 125\u001b[0m expression_predicate,\n\u001b[1;32m 126\u001b[0m data_id,\n\u001b[1;32m 127\u001b[0m region\u001b[38;5;241m=\u001b[39mregion,\n\u001b[1;32m 128\u001b[0m governor_constraints\u001b[38;5;241m=\u001b[39mgovernor_constraints,\n\u001b[1;32m 129\u001b[0m )\n", + "File \u001b[0;32m~/lsst_stack_w_2023_44/stack/miniconda3-py38_4.9.2-7.0.1/DarwinX86/daf_butler/ge89626a060+c4141ea9c4/python/lsst/daf/butler/registry/queries/expressions/_predicate.py:138\u001b[0m, in \u001b[0;36mmake_string_expression_predicate\u001b[0;34m(string, dimensions, column_types, bind, data_id, defaults, dataset_type_name, allow_orphans)\u001b[0m\n\u001b[1;32m 136\u001b[0m tree \u001b[38;5;241m=\u001b[39m parser\u001b[38;5;241m.\u001b[39mparse(string)\n\u001b[1;32m 137\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[0;32m--> 138\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m UserExpressionSyntaxError(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFailed to parse user expression \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mstring\u001b[38;5;132;01m!r}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[1;32m 139\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m bind \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 140\u001b[0m bind \u001b[38;5;241m=\u001b[39m {}\n", + "\u001b[0;31mUserExpressionSyntaxError\u001b[0m: Failed to parse user expression 'id=4d673e07-c749-4d80-9dcf-b39615a802a4'." + ] + } + ], + "source": [ + "bulteridtest = registry.queryDatasets('calexp', collections=collection, where=f'id={testid}')" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "9beca3d0-2e1d-4459-a6ad-d859c12b64fa", + "metadata": {}, + "outputs": [], + "source": [ + "#vdr2 = butler.registry.queryDimensionRecords(\"visit_detector_region\", datasets='calexp', collections=collection, instrument='HSC', physical_filter='HSC-R')\n", + "# all_vdr = butler.registry.queryDatasets('calexp', physical_filter='HSC-R', collections=collection, instrument='HSC') # nope 11/27/2023 COC" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "8249ccc7-e595-44ce-8f33-2b2c74e10a56", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "There are 240 records in all_vdr.\n", + "Rate was 21614.0134 matches/second. (We performed 21406 matches in 0.9903759956359863 seconds.)\n" + ] + } + ], + "source": [ + "match_dict = {}\n", + "match_by_keys = {}\n", + "\n", + "# all_vdr = vdr\n", + "all_vdr = butler.registry.queryDimensionRecords(\"visit_detector_region\", datasets='calexp', collections=collection, instrument='HSC') # removing , physical_filter='HSC-R'\n", + "all_vdr_count = 0\n", + "\n", + "for i in all_vdr: all_vdr_count += 1\n", + "print(f'There are {all_vdr_count} records in all_vdr.')\n", + "\n", + "def make_key(vdr):\n", + " this_key = f'{this_vdr.dataId[\"instrument\"]}_{this_vdr.dataId[\"detector\"]}_{this_vdr.dataId[\"visit\"]}'\n", + " return(this_key)\n", + "\n", + "check_count = 0\n", + "start_time = time.time()\n", + "for i, this_vdr in enumerate(all_vdr):\n", + " this_key = make_key(this_vdr)\n", + " # print(this_key)\n", + " matches_ = []\n", + " matches_by_keys_ = []\n", + " # print(this_vdr.region)\n", + " for j, other_vdr in enumerate(all_vdr):\n", + " other_key = make_key(other_vdr)\n", + " if j == i: \n", + " continue\n", + "# if this_vdr.region.contains(other_vdr.region):\n", + " if this_vdr.region.intersects(other_vdr.region):\n", + " check_count += 1\n", + " # print('hi') # testing; many showed up here but not in dict?\n", + " matches.append(this_vdr)\n", + " matches_by_keys_.append(f'{this_key} intersects {other_key}')\n", + " match_dict[this_vdr] = matches_\n", + " match_by_keys[this_key] = matches_by_keys_\n", + "\n", + "elapsed = time.time() - start_time\n", + "rate = check_count / elapsed # seeing ~20,000/s on my MBP 11/27/2023 COC\n", + "print(f'Rate was {round(rate,4)} matches/second. (We performed {check_count} matches in {elapsed} seconds.)')" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "892331f6-f907-4eeb-aeb2-a963e7d20cc6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reminder: all_vdr_count = 240\n", + "HSC_41_322: 134\n", + "HSC_41_346: 95\n", + "HSC_41_358: 141\n", + "HSC_41_1178: 70\n", + "HSC_41_1184: 100\n", + "HSC_41_1204: 71\n", + "HSC_41_1206: 91\n", + "HSC_41_1214: 70\n", + "HSC_41_1220: 100\n", + "HSC_41_1242: 97\n", + "HSC_41_1248: 138\n", + "HSC_41_11690: 90\n", + "HSC_41_11694: 93\n", + "HSC_41_11696: 139\n", + "HSC_41_11698: 96\n", + "HSC_41_11704: 48\n", + "HSC_41_11710: 131\n", + "HSC_41_11724: 139\n", + "HSC_41_11738: 131\n", + "HSC_41_11740: 122\n", + "HSC_41_17900: 90\n", + "HSC_41_17904: 93\n", + "HSC_41_17906: 139\n", + "HSC_41_17926: 64\n", + "HSC_41_17948: 107\n", + "HSC_41_17950: 135\n", + "HSC_41_19680: 139\n", + "HSC_41_19684: 64\n", + "HSC_41_19694: 41\n", + "HSC_41_19696: 48\n", + "HSC_41_22632: 90\n", + "HSC_41_22662: 72\n", + "HSC_41_23694: 69\n", + "HSC_41_23704: 93\n", + "HSC_41_23706: 139\n", + "HSC_41_23718: 64\n", + "HSC_41_29336: 134\n", + "HSC_41_29350: 69\n", + "HSC_41_30482: 107\n", + "HSC_41_30490: 69\n", + "HSC_42_322: 107\n", + "HSC_42_346: 139\n", + "HSC_42_358: 100\n", + "HSC_42_1178: 74\n", + "HSC_42_1184: 60\n", + "HSC_42_1204: 72\n", + "HSC_42_1206: 122\n", + "HSC_42_1214: 74\n", + "HSC_42_1220: 60\n", + "HSC_42_1242: 139\n", + "HSC_42_1248: 103\n", + "HSC_42_11690: 81\n", + "HSC_42_11694: 128\n", + "HSC_42_11696: 110\n", + "HSC_42_11698: 57\n", + "HSC_42_11704: 94\n", + "HSC_42_11710: 107\n", + "HSC_42_11724: 110\n", + "HSC_42_11738: 107\n", + "HSC_42_11740: 118\n", + "HSC_42_17900: 81\n", + "HSC_42_17904: 128\n", + "HSC_42_17906: 110\n", + "HSC_42_17926: 92\n", + "HSC_42_17948: 134\n", + "HSC_42_17950: 88\n", + "HSC_42_19680: 110\n", + "HSC_42_19684: 92\n", + "HSC_42_19694: 69\n", + "HSC_42_19696: 94\n", + "HSC_42_22632: 141\n", + "HSC_42_22662: 68\n", + "HSC_42_23694: 72\n", + "HSC_42_23704: 128\n", + "HSC_42_23706: 110\n", + "HSC_42_23718: 92\n", + "HSC_42_29336: 63\n", + "HSC_42_29350: 42\n", + "HSC_42_30482: 134\n", + "HSC_42_30490: 42\n", + "HSC_47_322: 41\n", + "HSC_47_346: 37\n", + "HSC_47_358: 39\n", + "HSC_47_1178: 33\n", + "HSC_47_1184: 37\n", + "HSC_47_1204: 33\n", + "HSC_47_1206: 38\n", + "HSC_47_1214: 33\n", + "HSC_47_1220: 37\n", + "HSC_47_1242: 37\n", + "HSC_47_1248: 39\n", + "HSC_47_11690: 36\n", + "HSC_47_11694: 37\n", + "HSC_47_11696: 39\n", + "HSC_47_11698: 36\n", + "HSC_47_11704: 21\n", + "HSC_47_11710: 25\n", + "HSC_47_11724: 39\n", + "HSC_47_11738: 25\n", + "HSC_47_11740: 36\n", + "HSC_47_17900: 36\n", + "HSC_47_17904: 37\n", + "HSC_47_17906: 39\n", + "HSC_47_17926: 33\n", + "HSC_47_17948: 21\n", + "HSC_47_17950: 15\n", + "HSC_47_19680: 39\n", + "HSC_47_19684: 33\n", + "HSC_47_19694: 31\n", + "HSC_47_19696: 21\n", + "HSC_47_22632: 38\n", + "HSC_47_22662: 33\n", + "HSC_47_23694: 33\n", + "HSC_47_23704: 37\n", + "HSC_47_23706: 39\n", + "HSC_47_23718: 33\n", + "HSC_47_29336: 32\n", + "HSC_47_29350: 36\n", + "HSC_47_30482: 21\n", + "HSC_47_30490: 36\n", + "HSC_49_322: 137\n", + "HSC_49_346: 89\n", + "HSC_49_358: 148\n", + "HSC_49_1178: 113\n", + "HSC_49_1184: 145\n", + "HSC_49_1204: 116\n", + "HSC_49_1206: 96\n", + "HSC_49_1214: 113\n", + "HSC_49_1220: 145\n", + "HSC_49_1242: 92\n", + "HSC_49_1248: 142\n", + "HSC_49_11690: 113\n", + "HSC_49_11694: 94\n", + "HSC_49_11696: 134\n", + "HSC_49_11698: 149\n", + "HSC_49_11704: 68\n", + "HSC_49_11710: 87\n", + "HSC_49_11724: 134\n", + "HSC_49_11738: 87\n", + "HSC_49_11740: 89\n", + "HSC_49_17900: 113\n", + "HSC_49_17904: 94\n", + "HSC_49_17906: 134\n", + "HSC_49_17926: 99\n", + "HSC_49_17948: 55\n", + "HSC_49_17950: 68\n", + "HSC_49_19680: 134\n", + "HSC_49_19684: 99\n", + "HSC_49_19694: 82\n", + "HSC_49_19696: 68\n", + "HSC_49_22632: 81\n", + "HSC_49_22662: 116\n", + "HSC_49_23694: 113\n", + "HSC_49_23704: 94\n", + "HSC_49_23706: 134\n", + "HSC_49_23718: 99\n", + "HSC_49_29336: 102\n", + "HSC_49_29350: 141\n", + "HSC_49_30482: 55\n", + "HSC_49_30490: 141\n", + "HSC_50_322: 122\n", + "HSC_50_346: 149\n", + "HSC_50_358: 117\n", + "HSC_50_1178: 128\n", + "HSC_50_1184: 91\n", + "HSC_50_1204: 127\n", + "HSC_50_1206: 144\n", + "HSC_50_1214: 128\n", + "HSC_50_1220: 91\n", + "HSC_50_1242: 149\n", + "HSC_50_1248: 118\n", + "HSC_50_11690: 119\n", + "HSC_50_11694: 144\n", + "HSC_50_11696: 119\n", + "HSC_50_11698: 90\n", + "HSC_50_11704: 125\n", + "HSC_50_11710: 78\n", + "HSC_50_11724: 119\n", + "HSC_50_11738: 78\n", + "HSC_50_11740: 100\n", + "HSC_50_17900: 119\n", + "HSC_50_17904: 144\n", + "HSC_50_17906: 119\n", + "HSC_50_17926: 150\n", + "HSC_50_17948: 81\n", + "HSC_50_17950: 55\n", + "HSC_50_19680: 119\n", + "HSC_50_19684: 150\n", + "HSC_50_19694: 141\n", + "HSC_50_19696: 125\n", + "HSC_50_22632: 151\n", + "HSC_50_22662: 122\n", + "HSC_50_23694: 127\n", + "HSC_50_23704: 144\n", + "HSC_50_23706: 119\n", + "HSC_50_23718: 150\n", + "HSC_50_29336: 57\n", + "HSC_50_29350: 85\n", + "HSC_50_30482: 81\n", + "HSC_50_30490: 85\n", + "HSC_58_322: 76\n", + "HSC_58_346: 86\n", + "HSC_58_358: 74\n", + "HSC_58_1178: 119\n", + "HSC_58_1184: 77\n", + "HSC_58_1204: 125\n", + "HSC_58_1206: 94\n", + "HSC_58_1214: 119\n", + "HSC_58_1220: 77\n", + "HSC_58_1242: 90\n", + "HSC_58_1248: 74\n", + "HSC_58_11690: 91\n", + "HSC_58_11694: 91\n", + "HSC_58_11696: 73\n", + "HSC_58_11698: 79\n", + "HSC_58_11704: 83\n", + "HSC_58_11710: 31\n", + "HSC_58_11724: 73\n", + "HSC_58_11738: 31\n", + "HSC_58_11740: 50\n", + "HSC_58_17900: 91\n", + "HSC_58_17904: 91\n", + "HSC_58_17906: 73\n", + "HSC_58_17926: 117\n", + "HSC_58_17948: 27\n", + "HSC_58_17950: 17\n", + "HSC_58_19680: 73\n", + "HSC_58_19684: 117\n", + "HSC_58_19694: 149\n", + "HSC_58_19696: 83\n", + "HSC_58_22632: 87\n", + "HSC_58_22662: 116\n", + "HSC_58_23694: 123\n", + "HSC_58_23704: 91\n", + "HSC_58_23706: 73\n", + "HSC_58_23718: 117\n", + "HSC_58_29336: 30\n", + "HSC_58_29350: 102\n", + "HSC_58_30482: 27\n", + "HSC_58_30490: 101\n" + ] + } + ], + "source": [ + "#for i, a_vdr in enumerate(match_dict.keys()): print(f'{i}: {len(match_dict[a_vdr])}')\n", + "# for i, a_vdr in enumerate(match_dict.keys()): print(f'{len(match_dict[a_vdr])!s:>5} matches for {a_vdr.dataId}')\n", + "# print(match_by_keys.keys())\n", + "print(f'Reminder: all_vdr_count = {all_vdr_count}')\n", + "for i, a_key in enumerate(match_by_keys.keys()):\n", + " print(f'{a_key}: {len(match_by_keys[a_key])}')" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "6f87f462-789b-424b-b2a6-85080d7e3bab", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6000000" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "n_chips_month_lsst = 1000*30*200\n", + "n_chips_month_lsst" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "f2f388e6-763a-4127-b731-fa9ac48b6dab", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Brute force chip-chip (all): 51.1 years (single-thread) to match 1 month of LSST chips.\n" + ] + } + ], + "source": [ + "compute_yrs_for_lsst_month = ((n_chips_month_lsst*n_chips_month_lsst)/rate)/60/60/24/365\n", + "print(f'Brute force chip-chip (all): {round(compute_yrs_for_lsst_month,1)} years (single-thread) to match 1 month of LSST chips.')" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "2326484e-d4c1-4f3b-a01d-d78136d24af5", + "metadata": {}, + "outputs": [], + "source": [ + "# vdr = butler.registry.queryDimensionRecords(\"visit_detector_region\", datasets='calexp', collections=collection, instrument='HSC', physical_filter='HSC-R') # more specific, just the calex stuff\n", + "# butler.registry.queryDatasets('calexp', physical_filter='HSC-R', collections=collection, instrument='HSC')\n", + "datasetRefs = butler.registry.queryDatasets('calexp', \n", + " # physical_filter='HSC-R', \n", + " collections=collection, \n", + " instrument='HSC')\n", + "# datasetRefs = butler.registry.queryDatasets(datasetType='calexp', \n", + "# collection = f\"u/{os.environ['USER']}/single_frame\", # recall\n", + "# # band='i', detector=175,\n", + "# # where='visit > 192000 and visit < 193000'\n", + "# )\n" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "6e129012-cf56-4b50-a543-a7b8d5c378a5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{band: 'y', instrument: 'HSC', detector: 41, physical_filter: 'HSC-Y', visit_system: 0, visit: 322}\n", + "{band: 'y', instrument: 'HSC', detector: 41, physical_filter: 'HSC-Y', visit_system: 0, visit: 346}\n", + "{band: 'y', instrument: 'HSC', detector: 41, physical_filter: 'HSC-Y', visit_system: 0, visit: 358}\n", + "{band: 'z', instrument: 'HSC', detector: 41, physical_filter: 'HSC-Z', visit_system: 0, visit: 1178}\n", + "{band: 'z', instrument: 'HSC', detector: 41, physical_filter: 'HSC-Z', visit_system: 0, visit: 1184}\n", + "...\n", + "There are 239 records total.\n" + ] + } + ], + "source": [ + "thiscounter = 0\n", + "for i, ref in enumerate(datasetRefs.expanded()):\n", + " thiscounter = i\n", + " if i < 5: print(ref.dataId.full)\n", + "print('...') # like this idea in the DP0.2 notebook 12/4/2023 COC\n", + "print(f'There are {thiscounter} records total.')" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "69cf7f05-1373-4054-94fc-fc7273596723", + "metadata": {}, + "outputs": [], + "source": [ + "# for i, ref in enumerate(datasetRefs.expanded()):\n", + "# bbox = butler.get('calexp.bbox', dataId=ref.dataId)\n", + "# wcs = butler.get('calexp.wcs', dataId=ref.dataId)\n", + "# crnr_ra, crnr_dec = get_corners_radec(wcs, bbox)\n", + "# tmp = ''\n", + "# for c in range(4):\n", + "# tmp += f'({crnr_ra[c]:.3f},{crnr_dec[c]:.3f}) '\n", + "# print(i, tmp)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "5a8e930d-7b9c-4bb0-95a1-ab5e5abbf284", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example region: ConvexPolygon([UnitVector3d(-0.8679157412883791, 0.4953768322146207, 0.03638763703307745), UnitVector3d(-0.8678508112373716, 0.49533452653358495, 0.038453559762199246), UnitVector3d(-0.8659604515352447, 0.49863199273540854, 0.03845298684875526), UnitVector3d(-0.8660276891555382, 0.4986705548678019, 0.036382953752507885)])\n" + ] + } + ], + "source": [ + "pointing_regions = []\n", + "for i, ref in enumerate(datasetRefs.expanded()):\n", + " if i == 0: \n", + " print(f'Example region: {ref.dataId.region}')\n", + " tmpref = ref\n", + " pointing_regions.append(ref.dataId.region)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "64834ef2-eba6-4512-a117-1acc14425bbf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "ConvexPolygon([UnitVector3d(-0.8679157412883791, 0.4953768322146207, 0.03638763703307745), UnitVector3d(-0.8678508112373716, 0.49533452653358495, 0.038453559762199246), UnitVector3d(-0.8659604515352447, 0.49863199273540854, 0.03845298684875526), UnitVector3d(-0.8660276891555382, 0.4986705548678019, 0.036382953752507885)])" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tmpref.dataId.region" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "06ce5618-40e8-46e7-b825-ea0fe0c5e847", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Box(NormalizedAngleInterval.fromRadians(0.0, 0.05235987755982989), AngleInterval.fromRadians(-1.5707963267948966, -1.5184364492350666))" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# from separate Patches on Sky Notebook\n", + "r = b'b\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xd6\\xeb{\\xf3\\xe9\\xce\\xaa?\\x18-DT\\xfb!\\xf9\\xbf\\xb9M\\xa8\\x04\\x84K\\xf8\\xbf'\n", + "rd = sphgeom.Region.decode(r)\n", + "rd" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "870f142c-d186-4880-b782-3c03da562276", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Checked 240 times, found 0 matches.\n" + ] + } + ], + "source": [ + "c = 0\n", + "intersect_count = 0\n", + "for i in pointing_regions:\n", + " c += 1\n", + " if i.intersects(rd):\n", + " print(f'Intersects!')\n", + " intersect_count += 1\n", + "print(f'Checked {c} times, found {intersect_count} matches.')" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}