Skip to content

Instantly share code, notes, and snippets.

@josePhoenix
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save josePhoenix/dcc012a653d81b1effd1 to your computer and use it in GitHub Desktop.

Select an option

Save josePhoenix/dcc012a653d81b1effd1 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"source": [
"%pylab inline --no-import-all"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from astropy.io import fits\n",
"import pysynphot"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"f115w_hdul = fits.open('/grp/jwst/ote/webbpsf-data/NIRISS/filters/F115W_throughput.fits')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"f115w = f115w_hdul[1].data"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"band = pysynphot.spectrum.ArraySpectralElement(\n",
" throughput=f115w.THROUGHPUT,\n",
" wave=f115w.WAVELENGTH,\n",
" waveunits='angstrom',\n",
" name='F115W'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5000.0\n"
]
}
],
"source": [
"print np.min(band.wave)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"micron\n",
"0.5\n"
]
}
],
"source": [
"band.convert('um')\n",
"print band.waveunits\n",
"print np.min(band.wave)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"wl = band.wave\n",
"thru = band.throughput"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"angstrom\n",
"5000.0\n"
]
}
],
"source": [
"print band.waveunits\n",
"print np.min(band.wave)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.8"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment