Skip to content

Commit

Permalink
Merge branch 'skysim_tutorial' of https://github.com/patricialarsen/D…
Browse files Browse the repository at this point in the history
…C2-analysis into skysim_tutorial - necessary to include updates to repo
  • Loading branch information
Patricia Larsen committed May 9, 2024
2 parents c0b21d3 + 5abed39 commit 4a67a86
Show file tree
Hide file tree
Showing 6 changed files with 456 additions and 123 deletions.
65 changes: 53 additions & 12 deletions tutorials/extragalactic_gcr_cluster_colors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@
"\n",
"Owners: **Dan Korytov [@dkorytov](https://github.com/LSSTDESC/DC2-analysis/issues/new?body=@dkorytov)**\n",
"\n",
"Last verified run: Nov 30, 2018 (by @yymao)\n",
"Last verified run: Mar 8, 2024 (by @patricialarsen)\n",
"\n",
"This notebook demonstrates how to access the extra galactic catalog through the Generic Catalog Reader (GCR, https://github.com/yymao/generic-catalog-reader) as well as how filter on galaxy features and cluster membership.\n",
"\n",
"__Objectives__:\n",
"\n",
"After working through and studying this Notebook you should be able to\n",
"\n",
"1. Access extragalactic catalogs (protoDC2, cosmoDC2) through the GCR\n",
"1. Access extragalactic catalogs (cosmoDC2, skysim, roman_rubin) through the GCR\n",
"2. Filter on galaxy properties\n",
"3. Select and plot cluster members\n",
"\n",
"\n",
"__Logistics__: This notebook is intended to be run through the JupyterHub NERSC interface available here: https://jupyter-dev.nersc.gov. To setup your NERSC environment, please follow the instructions available here: https://confluence.slac.stanford.edu/display/LSSTDESC/Using+Jupyter-dev+at+NERSC"
"__Logistics__: This notebook is intended to be run through the JupyterHub NERSC interface available here: https://jupyter.nersc.gov. To setup your NERSC environment, please follow the instructions available here: https://confluence.slac.stanford.edu/display/LSSTDESC/Using+Jupyter+at+NERSC"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import GCRCatalogs\n",
Expand All @@ -40,16 +42,50 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"gc = GCRCatalogs.load_catalog('cosmoDC2_v1.1.4_small')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Other catalog options:\n",
"Some alternate catalogs that you might want to look at include skysim, which is a 5000 square degree extragalactic catalog, and the Roman Rubin catalog which is a smaller extragalactic catalog and image simulation. To load these instead execute one of the two cells below.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"gc = GCRCatalogs.load_catalog('skysim5000_v1.1.2_small')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"gc = GCRCatalogs.load_catalog('roman_rubin_2023_v1.1.3_elais')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"data = gc.get_quantities(['halo_mass', 'redshift',\n",
Expand All @@ -65,15 +101,18 @@
"We load in the catalog with the \"load_catalog\" command, and then the values with the \"get_quantities\" command using filters to select sub-samples of the catalog. For this case we only need the magnitudes in several filters and the redshift. Galaxies are filtered on host halo mass to be at least 3e13 h$^{-1}$M$_\\odot$.\n",
"\n",
"### Help for error messages:\n",
"If this fails to find the appropriate quantities, check that the desc-python kernel is being used and if this is not available source the kernels by running the following command on a terminal at nersc: \"source /global/common/software/lsst/common/miniconda/setup_current_python.sh\"\n",
"If this fails to find the appropriate quantities, check that the desc-python kernel is being used and if this is not available source the kernels by running the following command on a terminal at nersc: \"source \n",
"/global/common/software/lsst/common/miniconda/kernels/setup.sh\"\n",
"\n",
"We are loading in a smaller version of the full cosmoDC2 catalog - this contains the same information as the full catalog but with a smaller sky area."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"plt.figure()\n",
Expand All @@ -95,7 +134,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"plt.figure()\n",
Expand All @@ -122,7 +163,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"After load the catalog and data, we are able to plot the color distribution as a function of redshift for cluster galaxies with very little effort!"
"After loading the catalog and data, we are able to plot the color distribution as a function of redshift for cluster galaxies with very little effort!"
]
}
],
Expand All @@ -142,9 +183,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
72 changes: 60 additions & 12 deletions tutorials/extragalactic_gcr_cluster_members.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,29 @@
"\n",
"Owners: **Dan Korytov [@dkorytov](https://github.com/LSSTDESC/DC2-analysis/issues/new?body=@dkorytov)**, **Patricia Larsen**\n",
"\n",
"Last verified run: **Nov 30, 2018** by @yymao\n",
"Last verified run: **March 8, 2024** by @patricialarsen\n",
"\n",
"This notebook demonstrates how to access the extra galactic catalog through the Generic Catalog Reader (GCR, https://github.com/yymao/generic-catalog-reader) as well as how filter on galaxy features and cluster membership.\n",
"\n",
"__Objectives__:\n",
"\n",
"After working through and studying this Notebook you should be able to\n",
"\n",
"1. Access extragalactic catalogs (protoDC2, cosmoDC2) through the GCR.\n",
"1. Access extragalactic catalogs (cosmoDC2, skysim, roman_rubin) through the GCR.\n",
"2. Select galaxy cluster centrals as a proxy for clusters.\n",
"3. Select galaxies in individual clusters by using the host_id quantity.\n",
"4. Plotting galaxy clustermembers positions on the sky as well as their comoving position in space.\n",
"\n",
"\n",
"__Logistics__: This notebook is intended to be run through the JupyterHub NERSC interface available here: https://jupyter-dev.nersc.gov. To setup your NERSC environment, please follow the instructions available here: https://confluence.slac.stanford.edu/display/LSSTDESC/Using+Jupyter-dev+at+NERSC"
"__Logistics__: This notebook is intended to be run through the JupyterHub NERSC interface available here: https://jupyter.nersc.gov. To setup your NERSC environment, please follow the instructions available here: https://confluence.slac.stanford.edu/display/LSSTDESC/Using+Jupyter+at+NERSC"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import GCRCatalogs\n",
Expand All @@ -49,7 +51,8 @@
"We load in the catalog with the \"load_catalog\" command, and then the values with the \"get_quantities\" command using filters to select sub-samples of the catalog. \n",
"\n",
"### Help for error messages:\n",
"If this fails to find the appropriate quantities, check that the desc-python kernel is being used and if this is not available source the kernels by running the following command on a terminal at nersc: \"source /global/common/software/lsst/common/miniconda/setup_current_python.sh\"\n",
"If this fails to find the appropriate quantities, check that the desc-python kernel is being used and if this is not available source the kernels by running the following command on a terminal at nersc: \"source \n",
"/global/common/software/lsst/common/miniconda/kernels/setup.sh\"\n",
"\n",
"We are loading in a smaller version of the full cosmoDC2 catalog - this contains the same information as the full catalog but with a smaller sky area."
]
Expand All @@ -63,10 +66,42 @@
"gc = GCRCatalogs.load_catalog('cosmoDC2_v1.1.4_small')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Other catalog options:\n",
"Some alternate catalogs that you might want to look at include skysim, which is a 5000 square degree extragalactic catalog, and the Roman Rubin catalog which is a smaller extragalactic catalog and image simulation. To load these instead execute one of the two cells below.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"gc = GCRCatalogs.load_catalog('skysim5000_v1.1.2_small')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"gc = GCRCatalogs.load_catalog('roman_rubin_2023_v1.1.3_elais')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"galaxy_data = gc.get_quantities(['ra', 'dec', 'mag_r', 'halo_id'], filters=['mag_r < 19'])\n",
Expand All @@ -79,7 +114,7 @@
"metadata": {},
"source": [
"### Plot individual clusters\n",
"The cluster_data we loaded selects for central galaxies in clusters of mass higher than 10^14 solar masses/h below redshift 0.2. We will plot three such clusters in the proto-DC2 region. \n",
"The cluster_data we loaded selects for central galaxies in clusters of mass higher than 10^14 solar masses/h below redshift 0.2. We will plot three such clusters in the skysim region. \n",
"\n",
"For each of these clusters we can match the galaxies by selecting on 'halo_id' and make a scatter plot of the projected positions around the central galaxy. Note that the size of the circles corresponds to the r-band magnitude of the galaxies. \n",
"\n",
Expand All @@ -89,7 +124,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"cluster_data = Table(cluster_data)\n",
Expand Down Expand Up @@ -126,7 +163,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"galaxy_data = gc.get_quantities(['ra', 'dec', 'mag_r', 'halo_id', 'position_x', 'position_y', 'velocity_x', 'velocity_y'], filters=['mag_r < 19'])\n",
Expand All @@ -137,7 +176,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"cluster_data = Table(cluster_data)\n",
Expand All @@ -161,6 +202,13 @@
" plt.colorbar(label='km/s')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -179,9 +227,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading

0 comments on commit 4a67a86

Please sign in to comment.