Skip to content

Instantly share code, notes, and snippets.

@pllim
Created July 20, 2018 16:59
Show Gist options
  • Select an option

  • Save pllim/4ce9d6b7e26431f8f803363182abb3cf to your computer and use it in GitHub Desktop.

Select an option

Save pllim/4ce9d6b7e26431f8f803363182abb3cf to your computer and use it in GitHub Desktop.
Observation that produces 1 counts/s
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"from astropy import units as u\n",
"\n",
"from synphot import SpectralElement, SourceSpectrum, Observation, units"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"area = 1 * (u.m * u.m)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [],
"source": [
"bp = SpectralElement.from_filter('johnson_v')"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"vega = SourceSpectrum.from_vega()"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4.219901493938552e-19 FLAM\n"
]
}
],
"source": [
"uresp = bp.unit_response(area)\n",
"print(uresp)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"sp = vega.normalize(uresp, band=bp)"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"obs = Observation(sp, bp)"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$0.9999998 \\; \\mathrm{\\frac{ct}{s}}$"
],
"text/plain": [
"<Quantity 0.9999998 ct / s>"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"obs.countrate(area)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment