Created
July 23, 2019 21:31
-
-
Save dharhas/8bae4e3a94e6f5b620e1a6f2b2aee940 to your computer and use it in GitHub Desktop.
create_sampled_lsst_dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Collecting https://github.com/Quansight/lsst_dashboard/archive/master.zip\n", | |
"\u001b[?25l Downloading https://github.com/Quansight/lsst_dashboard/archive/master.zip\n", | |
"\u001b[K / 245kB 4.6MB/s\n", | |
"\u001b[?25hBuilding wheels for collected packages: lsst-dashboard\n", | |
" Building wheel for lsst-dashboard (setup.py) ... \u001b[?25ldone\n", | |
"\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-qa9np0dr/wheels/5f/af/f0/e88175f91062230a231f064b54b8456f1e79b4cb94472d953f\n", | |
"Successfully built lsst-dashboard\n", | |
"Installing collected packages: lsst-dashboard\n", | |
" Found existing installation: lsst-dashboard 0.0.1\n", | |
" Uninstalling lsst-dashboard-0.0.1:\n", | |
" Successfully uninstalled lsst-dashboard-0.0.1\n", | |
"Successfully installed lsst-dashboard-0.0.1\n" | |
] | |
} | |
], | |
"source": [ | |
"!pip install --user --upgrade https://github.com/Quansight/lsst_dashboard/archive/master.zip" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from lsst_dashboard import Dataset, scan_folder" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"path = '/project/tmorton/tickets/DM-20015/RC2_w18'\n", | |
"tracts, filters = scan_folder(path) # parse folder and find available data" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[9697, 9813, 9615]" | |
] | |
}, | |
"execution_count": 14, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"tracts" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"['HSC-Y', 'HSC-R', 'HSC-Z', 'NB0921', 'HSC-I', 'HSC-G', 'color']" | |
] | |
}, | |
"execution_count": 15, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"filters" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"tables = ['analysisCoaddTable_forced', 'analysisCoaddTable_unforced', 'visitMatchTable']\n", | |
"tracts = ['9697', '9813', '9615']\n", | |
"filters = ['HSC-R', 'HSC-Z', 'HSC-I', 'HSC-G'] # HSC-Y is too big and crashes kernel" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"d = Dataset(path)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"d.connect()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"filt=HSC-R, table=analysisCoaddTable_forced, tract=9697\n", | |
"filt=HSC-R, table=analysisCoaddTable_forced, tract=9813\n", | |
"filt=HSC-R, table=analysisCoaddTable_forced, tract=9615\n", | |
"filt=HSC-R, table=analysisCoaddTable_unforced, tract=9697\n", | |
"filt=HSC-R, table=analysisCoaddTable_unforced, tract=9813\n", | |
"filt=HSC-R, table=analysisCoaddTable_unforced, tract=9615\n", | |
"filt=HSC-R, table=visitMatchTable, tract=9697\n", | |
"filt=HSC-R, table=visitMatchTable, tract=9813\n", | |
"filt=HSC-R, table=visitMatchTable, tract=9615\n", | |
"filt=HSC-Z, table=analysisCoaddTable_forced, tract=9697\n", | |
"filt=HSC-Z, table=analysisCoaddTable_forced, tract=9813\n", | |
"filt=HSC-Z, table=analysisCoaddTable_forced, tract=9615\n", | |
"filt=HSC-Z, table=analysisCoaddTable_unforced, tract=9697\n", | |
"filt=HSC-Z, table=analysisCoaddTable_unforced, tract=9813\n", | |
"filt=HSC-Z, table=analysisCoaddTable_unforced, tract=9615\n", | |
"filt=HSC-Z, table=visitMatchTable, tract=9697\n", | |
"filt=HSC-Z, table=visitMatchTable, tract=9813\n", | |
"filt=HSC-Z, table=visitMatchTable, tract=9615\n", | |
"filt=HSC-I, table=analysisCoaddTable_forced, tract=9697\n", | |
"filt=HSC-I, table=analysisCoaddTable_forced, tract=9813\n", | |
"filt=HSC-I, table=analysisCoaddTable_forced, tract=9615\n", | |
"filt=HSC-I, table=analysisCoaddTable_unforced, tract=9697\n", | |
"filt=HSC-I, table=analysisCoaddTable_unforced, tract=9813\n", | |
"filt=HSC-I, table=analysisCoaddTable_unforced, tract=9615\n", | |
"filt=HSC-I, table=visitMatchTable, tract=9697\n", | |
"filt=HSC-I, table=visitMatchTable, tract=9813\n", | |
"filt=HSC-I, table=visitMatchTable, tract=9615\n", | |
"filt=HSC-G, table=analysisCoaddTable_forced, tract=9697\n", | |
"filt=HSC-G, table=analysisCoaddTable_forced, tract=9813\n", | |
"filt=HSC-G, table=analysisCoaddTable_forced, tract=9615\n", | |
"filt=HSC-G, table=analysisCoaddTable_unforced, tract=9697\n", | |
"filt=HSC-G, table=analysisCoaddTable_unforced, tract=9813\n", | |
"filt=HSC-G, table=analysisCoaddTable_unforced, tract=9615\n", | |
"filt=HSC-G, table=visitMatchTable, tract=9697\n", | |
"filt=HSC-G, table=visitMatchTable, tract=9813\n", | |
"filt=HSC-G, table=visitMatchTable, tract=9615\n" | |
] | |
} | |
], | |
"source": [ | |
"d.fetch_tables(tables=tables, tracts=tracts, filters=filters, sample=1000)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 20, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"filt=HSC-R, tract=9697\n", | |
"filt=HSC-R, tract=9813\n", | |
"filt=HSC-R, tract=9615\n", | |
"filt=HSC-Z, tract=9697\n", | |
"filt=HSC-Z, tract=9813\n", | |
"filt=HSC-Z, tract=9615\n", | |
"filt=HSC-I, tract=9697\n", | |
"filt=HSC-I, tract=9813\n", | |
"filt=HSC-I, tract=9615\n", | |
"filt=HSC-G, tract=9697\n", | |
"filt=HSC-G, tract=9813\n", | |
"filt=HSC-G, tract=9615\n" | |
] | |
} | |
], | |
"source": [ | |
"d.fetch_visits(tracts=tracts, filters=filters, sample=1000)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"for filt in filters:\n", | |
" d.write_tables('tmp', filt)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "LSST", | |
"language": "python", | |
"name": "lsst" | |
}, | |
"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.7.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment