Skip to content

Instantly share code, notes, and snippets.

@rbiswas4
Created January 27, 2018 14:03
Show Gist options
  • Save rbiswas4/30915d2e0b9a925df007742549daa0a2 to your computer and use it in GitHub Desktop.
Save rbiswas4/30915d2e0b9a925df007742549daa0a2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "from lsst.sims.catUtils.supernovae import SNObject",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "s = SNObject(0, 0)\nprint(s.ebvofMW)",
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": "0.0315264239907\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "print(s.SNstate)",
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": "{'ModelSource': 'salt2-extended', 'z': 0.0, 't0': 0.0, 'x0': 1.0, 'x1': 0.0, 'c': 0.0, 'hostebv': 0.0, 'hostr_v': 3.1000000000000001, 'mwebv': 0.0, 'mwr_v': 3.1000000000000001, '_ra': 0.0, '_dec': 0.0, 'MWE(B-V)': 0.031526423990726471}\n",
"name": "stdout"
}
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": "### Let us try to change the coordinates and see if the extinction is autmatically changed"
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "from copy import deepcopy",
"execution_count": 4,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "p = deepcopy(s.SNstate)",
"execution_count": 5,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "p['_ra'] = 59\np['_dec'] = -28.5",
"execution_count": 6,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "p",
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 7,
"data": {
"text/plain": "{'MWE(B-V)': 0.031526423990726471,\n 'ModelSource': 'salt2-extended',\n '_dec': -28.5,\n '_ra': 59,\n 'c': 0.0,\n 'hostebv': 0.0,\n 'hostr_v': 3.1000000000000001,\n 'mwebv': 0.0,\n 'mwr_v': 3.1000000000000001,\n 't0': 0.0,\n 'x0': 1.0,\n 'x1': 0.0,\n 'z': 0.0}"
},
"metadata": {}
}
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": "### What happens if we change the coordinates"
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "l = s.fromSNState(p)",
"execution_count": 8,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "l.SNstate",
"execution_count": 9,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 9,
"data": {
"text/plain": "{'MWE(B-V)': 0.031526423990726471,\n 'ModelSource': 'salt2-extended',\n '_dec': -28.5,\n '_ra': 59.000000000000007,\n 'c': 0.0,\n 'hostebv': 0.0,\n 'hostr_v': 3.1000000000000001,\n 'mwebv': 0.0,\n 'mwr_v': 3.1000000000000001,\n 't0': 0.0,\n 'x0': 1.0,\n 'x1': 0.0,\n 'z': 0.0}"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "l.mwEBVfromMaps()",
"execution_count": 10,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "l.SNstate",
"execution_count": 11,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 11,
"data": {
"text/plain": "{'MWE(B-V)': 0.084146462380886078,\n 'ModelSource': 'salt2-extended',\n '_dec': -28.5,\n '_ra': 59.000000000000007,\n 'c': 0.0,\n 'hostebv': 0.0,\n 'hostr_v': 3.1000000000000001,\n 'mwebv': 0.0,\n 'mwr_v': 3.1000000000000001,\n 't0': 0.0,\n 'x0': 1.0,\n 'x1': 0.0,\n 'z': 0.0}"
},
"metadata": {}
}
]
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.6.2",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist_id": "30915d2e0b9a925df007742549daa0a2"
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment