Skip to content

Instantly share code, notes, and snippets.

@beckermr
Created April 22, 2022 22:01
Show Gist options
  • Save beckermr/e9307419ca5854083b910b34936b5043 to your computer and use it in GitHub Desktop.
Save beckermr/e9307419ca5854083b910b34936b5043 to your computer and use it in GitHub Desktop.
cosmodc2_to_wldeblend
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "import numpy as np\nimport GCRCatalogs",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "cat = GCRCatalogs.load_catalog(\"desc_cosmodc2\")",
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": "\nWARNING: version mismatch between CFITSIO header (v4.000999999999999) and linked library (v4.01).\n\n\nWARNING: version mismatch between CFITSIO header (v4.000999999999999) and linked library (v4.01).\n\n\nWARNING: version mismatch between CFITSIO header (v4.000999999999999) and linked library (v4.01).\n\n",
"name": "stderr"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "col_mapping = {\n \"g_ab\": \"mag_true_g\",\n \"r_ab\": \"mag_true_r\",\n \"i_ab\": \"mag_true_i\",\n \"z_ab\": \"mag_true_z\",\n \"fluxnorm_bulge\": \"bulge_to_total_ratio_i\",\n \"pa_disk\": \"position_angle_true\",\n \"pa_bulge\": \"position_angle_true\",\n \"a_d\": \"size_disk_true\",\n \"b_d\": \"size_minor_disk_true\",\n \"a_b\": \"size_bulge_true\",\n \"b_b\": \"size_minor_bulge_true\",\n \"redshift\": \"redshift\",\n \"galtileid\": \"galaxy_id\",\n}\n\ndtype = [\n (c, \"f8\" if c != \"galtileid\" else \"i8\") for c in col_mapping\n] + [(\"fluxnorm_agn\", \"f8\"), (\"fluxnorm_disk\", \"f8\")]\n\nd = np.zeros(len(cat), dtype=dtype)\n\nfor dcol, scol in col_mapping.items():\n d[dcol] = cat.get_quantities([scol])[scol]\n\nd[\"fluxnorm_disk\"] = 1.0 - d[\"fluxnorm_bulge\"]",
"execution_count": 39,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "conda-env-dc2-py",
"display_name": "Python [conda env:dc2]",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.9.12",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist": {
"id": "",
"data": {
"description": "cosmodc2_to_wldeblend",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment