Skip to content

Instantly share code, notes, and snippets.

@rbiswas4
Created June 29, 2018 05:48
Show Gist options
  • Save rbiswas4/de362ce2bd16f62835f0cd3f556bbcaf to your computer and use it in GitHub Desktop.
Save rbiswas4/de362ce2bd16f62835f0cd3f556bbcaf 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": "import sncosmo",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "from astropy.cosmology import Planck15 as cosmo",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "model = sncosmo.Model(source='salt2')",
"execution_count": 3,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "model.set(z=0.5, t0 = 59580.)",
"execution_count": 4,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "model.set_source_peakabsmag(-19.3, 'bessellb', magsys='ab', cosmo=cosmo)",
"execution_count": 5,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "print(model)",
"execution_count": 6,
"outputs": [
{
"output_type": "stream",
"text": "<Model at 0x10ab20748>\nsource:\n class : SALT2Source\n name : 'salt2'\n version : 2.4\n phases : [-20, .., 50] days\n wavelengths: [2000, .., 9200] Angstroms\nparameters:\n z = 0.5\n t0 = 59580.0\n x0 = 9.758576283608507e-06\n x1 = 0.0\n c = 0.0\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "model.source.peakphase(band_or_wave='BessellB')",
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 7,
"data": {
"text/plain": "-0.5888320931142653"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "model.source.peakmag(band='bessellb', magsys='ab', sampling=0.2)",
"execution_count": 8,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 8,
"data": {
"text/plain": "23.025676540850476"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "model.source_peakabsmag(band='bessellb', magsys='ab', cosmo=cosmo)",
"execution_count": 9,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 9,
"data": {
"text/plain": "-19.299999999999997"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"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": "de362ce2bd16f62835f0cd3f556bbcaf"
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment