{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from astropy.io import fits" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [], "source": [ "refheader = fits.getheader(\"../tests/data/WFPC2u57.fits\", ext=1)" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "XTENSION= 'TABLE ' / Ascii table extension \n", "BITPIX = 8 / 8-bits per 'pixels' \n", "NAXIS = 2 / Simple 2-D matrix \n", "NAXIS1 = 796 / Number of characters per row \n", "NAXIS2 = 4 / The number of rows \n", "PCOUNT = 0 / No 'random' parameters \n", "GCOUNT = 1 / Only one group \n", "TFIELDS = 49 / Number of fields per row \n", "EXTNAME = 'u5780205r_cvt.c0h.tab' / Name of table \n", " \n", "TTYPE1 = 'CRVAL1 ' / \n", "TBCOL1 = 1 / \n", "TFORM1 = 'D25.17 ' / \n", "TUNIT1 = ' ' / \n", "TDISP1 = 'G25.16 ' / %25.16g \n", " \n", "TTYPE2 = 'CRVAL2 ' / \n", "TBCOL2 = 27 / \n", "TFORM2 = 'D25.17 ' / \n", "TUNIT2 = ' ' / \n", "TDISP2 = 'G25.16 ' / %25.16g \n", " \n", "TTYPE3 = 'CRPIX1 ' / \n", "TBCOL3 = 53 / \n", "TFORM3 = 'E15.7 ' / \n", "TUNIT3 = ' ' / \n", "TDISP3 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE4 = 'CRPIX2 ' / \n", "TBCOL4 = 69 / \n", "TFORM4 = 'E15.7 ' / \n", "TUNIT4 = ' ' / \n", "TDISP4 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE5 = 'CD1_1 ' / \n", "TBCOL5 = 85 / \n", "TFORM5 = 'E15.7 ' / \n", "TUNIT5 = ' ' / \n", "TDISP5 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE6 = 'CD1_2 ' / \n", "TBCOL6 = 101 / \n", "TFORM6 = 'E15.7 ' / \n", "TUNIT6 = ' ' / \n", "TDISP6 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE7 = 'CD2_1 ' / \n", "TBCOL7 = 117 / \n", "TFORM7 = 'E15.7 ' / \n", "TUNIT7 = ' ' / \n", "TDISP7 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE8 = 'CD2_2 ' / \n", "TBCOL8 = 133 / \n", "TFORM8 = 'E15.7 ' / \n", "TUNIT8 = ' ' / \n", "TDISP8 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE9 = 'DATAMIN ' / \n", "TBCOL9 = 149 / \n", "TFORM9 = 'E15.7 ' / \n", "TUNIT9 = ' ' / \n", "TDISP9 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE10 = 'DATAMAX ' / \n", "TBCOL10 = 165 / \n", "TFORM10 = 'E15.7 ' / \n", "TUNIT10 = ' ' / \n", "TDISP10 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE11 = 'MIR_REVR' / \n", "TBCOL11 = 181 / \n", "TFORM11 = 'A1 ' / \n", "TUNIT11 = 'LOGICAL-' / \n", "TDISP11 = 'L1 ' / %1b \n", " \n", "TTYPE12 = 'ORIENTAT' / \n", "TBCOL12 = 183 / \n", "TFORM12 = 'E15.7 ' / \n", "TUNIT12 = ' ' / \n", "TDISP12 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE13 = 'FILLCNT ' / \n", "TBCOL13 = 199 / \n", "TFORM13 = 'I12 ' / \n", "TUNIT13 = ' ' / \n", "TDISP13 = 'I11 ' / %11d \n", " \n", "TTYPE14 = 'ERRCNT ' / \n", "TBCOL14 = 212 / \n", "TFORM14 = 'I12 ' / \n", "TUNIT14 = ' ' / \n", "TDISP14 = 'I11 ' / %11d \n", " \n", "TTYPE15 = 'FPKTTIME' / \n", "TBCOL15 = 225 / \n", "TFORM15 = 'D25.17 ' / \n", "TUNIT15 = ' ' / \n", "TDISP15 = 'G25.16 ' / %25.16g \n", " \n", "TTYPE16 = 'LPKTTIME' / \n", "TBCOL16 = 251 / \n", "TFORM16 = 'D25.17 ' / \n", "TUNIT16 = ' ' / \n", "TDISP16 = 'G25.16 ' / %25.16g \n", " \n", "TTYPE17 = 'CTYPE1 ' / \n", "TBCOL17 = 277 / \n", "TFORM17 = 'A8 ' / \n", "TUNIT17 = 'CHARACTER*8' / \n", "TDISP17 = 'A8 ' / %-8s \n", " \n", "TTYPE18 = 'CTYPE2 ' / \n", "TBCOL18 = 286 / \n", "TFORM18 = 'A8 ' / \n", "TUNIT18 = 'CHARACTER*8' / \n", "TDISP18 = 'A8 ' / %-8s \n", " \n", "TTYPE19 = 'DETECTOR' / \n", "TBCOL19 = 295 / \n", "TFORM19 = 'I12 ' / \n", "TUNIT19 = ' ' / \n", "TDISP19 = 'I11 ' / %11d \n", " \n", "TTYPE20 = 'DEZERO ' / \n", "TBCOL20 = 308 / \n", "TFORM20 = 'E15.7 ' / \n", "TUNIT20 = ' ' / \n", "TDISP20 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE21 = 'BIASEVEN' / \n", "TBCOL21 = 324 / \n", "TFORM21 = 'E15.7 ' / \n", "TUNIT21 = ' ' / \n", "TDISP21 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE22 = 'BIASODD ' / \n", "TBCOL22 = 340 / \n", "TFORM22 = 'E15.7 ' / \n", "TUNIT22 = ' ' / \n", "TDISP22 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE23 = 'GOODMIN ' / \n", "TBCOL23 = 356 / \n", "TFORM23 = 'E15.7 ' / \n", "TUNIT23 = ' ' / \n", "TDISP23 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE24 = 'GOODMAX ' / \n", "TBCOL24 = 372 / \n", "TFORM24 = 'E15.7 ' / \n", "TUNIT24 = ' ' / \n", "TDISP24 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE25 = 'DATAMEAN' / \n", "TBCOL25 = 388 / \n", "TFORM25 = 'E15.7 ' / \n", "TUNIT25 = ' ' / \n", "TDISP25 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE26 = 'GPIXELS ' / \n", "TBCOL26 = 404 / \n", "TFORM26 = 'I12 ' / \n", "TUNIT26 = ' ' / \n", "TDISP26 = 'I11 ' / %11d \n", " \n", "TTYPE27 = 'SOFTERRS' / \n", "TBCOL27 = 417 / \n", "TFORM27 = 'I12 ' / \n", "TUNIT27 = ' ' / \n", "TDISP27 = 'I11 ' / %11d \n", " \n", "TTYPE28 = 'CALIBDEF' / \n", "TBCOL28 = 430 / \n", "TFORM28 = 'I12 ' / \n", "TUNIT28 = ' ' / \n", "TDISP28 = 'I11 ' / %11d \n", " \n", "TTYPE29 = 'STATICD ' / \n", "TBCOL29 = 443 / \n", "TFORM29 = 'I12 ' / \n", "TUNIT29 = ' ' / \n", "TDISP29 = 'I11 ' / %11d \n", " \n", "TTYPE30 = 'ATODSAT ' / \n", "TBCOL30 = 456 / \n", "TFORM30 = 'I12 ' / \n", "TUNIT30 = ' ' / \n", "TDISP30 = 'I11 ' / %11d \n", " \n", "TTYPE31 = 'DATALOST' / \n", "TBCOL31 = 469 / \n", "TFORM31 = 'I12 ' / \n", "TUNIT31 = ' ' / \n", "TDISP31 = 'I11 ' / %11d \n", " \n", "TTYPE32 = 'BADPIXEL' / \n", "TBCOL32 = 482 / \n", "TFORM32 = 'I12 ' / \n", "TUNIT32 = ' ' / \n", "TDISP32 = 'I11 ' / %11d \n", " \n", "TTYPE33 = 'OVERLAP ' / \n", "TBCOL33 = 495 / \n", "TFORM33 = 'I12 ' / \n", "TUNIT33 = ' ' / \n", "TDISP33 = 'I11 ' / %11d \n", " \n", "TTYPE34 = 'PHOTMODE' / \n", "TBCOL34 = 508 / \n", "TFORM34 = 'A48 ' / \n", "TUNIT34 = 'CHARACTER*48' / \n", "TDISP34 = 'A48 ' / %-48s \n", " \n", "TTYPE35 = 'PHOTFLAM' / \n", "TBCOL35 = 557 / \n", "TFORM35 = 'E15.7 ' / \n", "TUNIT35 = ' ' / \n", "TDISP35 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE36 = 'PHOTZPT ' / \n", "TBCOL36 = 573 / \n", "TFORM36 = 'E15.7 ' / \n", "TUNIT36 = ' ' / \n", "TDISP36 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE37 = 'PHOTPLAM' / \n", "TBCOL37 = 589 / \n", "TFORM37 = 'E15.7 ' / \n", "TUNIT37 = ' ' / \n", "TDISP37 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE38 = 'PHOTBW ' / \n", "TBCOL38 = 605 / \n", "TFORM38 = 'E15.7 ' / \n", "TUNIT38 = ' ' / \n", "TDISP38 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE39 = 'MEDIAN ' / \n", "TBCOL39 = 621 / \n", "TFORM39 = 'E15.7 ' / \n", "TUNIT39 = ' ' / \n", "TDISP39 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE40 = 'MEDSHADO' / \n", "TBCOL40 = 637 / \n", "TFORM40 = 'E15.7 ' / \n", "TUNIT40 = ' ' / \n", "TDISP40 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE41 = 'HISTWIDE' / \n", "TBCOL41 = 653 / \n", "TFORM41 = 'E15.7 ' / \n", "TUNIT41 = ' ' / \n", "TDISP41 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE42 = 'SKEWNESS' / \n", "TBCOL42 = 669 / \n", "TFORM42 = 'E15.7 ' / \n", "TUNIT42 = ' ' / \n", "TDISP42 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE43 = 'MEANC10 ' / \n", "TBCOL43 = 685 / \n", "TFORM43 = 'E15.7 ' / \n", "TUNIT43 = ' ' / \n", "TDISP43 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE44 = 'MEANC25 ' / \n", "TBCOL44 = 701 / \n", "TFORM44 = 'E15.7 ' / \n", "TUNIT44 = ' ' / \n", "TDISP44 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE45 = 'MEANC50 ' / \n", "TBCOL45 = 717 / \n", "TFORM45 = 'E15.7 ' / \n", "TUNIT45 = ' ' / \n", "TDISP45 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE46 = 'MEANC100' / \n", "TBCOL46 = 733 / \n", "TFORM46 = 'E15.7 ' / \n", "TUNIT46 = ' ' / \n", "TDISP46 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE47 = 'MEANC200' / \n", "TBCOL47 = 749 / \n", "TFORM47 = 'E15.7 ' / \n", "TUNIT47 = ' ' / \n", "TDISP47 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE48 = 'MEANC300' / \n", "TBCOL48 = 765 / \n", "TFORM48 = 'E15.7 ' / \n", "TUNIT48 = ' ' / \n", "TDISP48 = 'G15.7 ' / %15.7g \n", " \n", "TTYPE49 = 'BACKGRND' / \n", "TBCOL49 = 781 / \n", "TFORM49 = 'E15.7 ' / \n", "TUNIT49 = ' ' / \n", "TDISP49 = 'G15.7 ' / %15.7g \n", " \n", "CRVAL1 = 'right ascension of reference pixel (deg)' / \n", "CRVAL2 = 'declination of reference pixel (deg)' / \n", "CRPIX1 = 'x-coordinate of reference pixel' / \n", "CRPIX2 = 'y-coordinate of reference pixel' / \n", "CD1_1 = 'partial of the right ascension w.r.t. x' / \n", "CD1_2 = 'partial of the right ascension w.r.t. y' / \n", "CD2_1 = 'partial of the declination w.r.t. x' / \n", "CD2_2 = 'partial of the declination w.r.t. y' / \n", "DATAMIN = 'minimum value of the data' / \n", "DATAMAX = 'maximum value of the data' / \n", "MIR_REVR= 'is the image mirror reversed?' / \n", "ORIENTAT= 'orientation of the image (deg)' / \n", "FILLCNT = 'number of segments containing fill' / \n", "ERRCNT = 'number of segments containing errors' / \n", "FPKTTIME= 'time of the first packet (Modified Julian Date)' / \n", "LPKTTIME= 'time of the last packet (Modified Julian Date)' / \n", "CTYPE1 = 'first coordinate type' / \n", "CTYPE2 = 'second coordinate type' / \n", "DETECTOR= 'CCD detector: PC 1, WFC 2-4' / \n", "DEZERO = 'mean bias level from EED extended register' / \n", "BIASEVEN= 'bias level for even-numbered columns' / \n", "BIASODD = 'bias level for odd-numbered columns' / \n", "GOODMIN = 'minimum value of the \"good\" pixels' / \n", "GOODMAX = 'maximum value of the \"good\" pixels' / \n", "DATAMEAN= 'mean value of the \"good\" pixels' / \n", "GPIXELS = 'number of \"good\" pixels (DQF = 0)' / \n", "SOFTERRS= 'number of \"soft error\" pixels (DQF = 1)' / \n", "CALIBDEF= 'number of \"calibration defect\" pixels (DQF = 2)' / \n", "STATICD = 'number of \"static defect\" pixels (DQF = 4)' / \n", "ATODSAT = 'number of \"AtoD saturated\" pixels (DQF = 8)' / \n", "DATALOST= 'number of \"data lost\" pixels (DQF = 16)' / \n", "BADPIXEL= 'number of \"generic bad\" pixels (DQF = 32)' / \n", "OVERLAP = 'number of \"image overlap\" pixels (DQF = 64)' / \n", "PHOTMODE= 'Photometry mode' / \n", "PHOTFLAM= 'Inverse Sensitivity' / \n", "PHOTZPT = 'Zero point' / \n", "PHOTPLAM= 'Pivot wavelength' / \n", "PHOTBW = 'RMS bandwidth of the filter' / \n", "MEDIAN = 'middle data value when good qual pixels sorted' / \n", "MEDSHADO= 'median pixel value in shadow of pyramid edge' / \n", "HISTWIDE= 'width of the histogram' / \n", "SKEWNESS= 'skewness of the histogram' / \n", "MEANC10 = 'mean of a 10x10 region at center of chip' / \n", "MEANC25 = 'mean of a 25x25 region at center of chip' / \n", "MEANC50 = 'mean of a 50x50 region at center of chip' / \n", "MEANC100= 'mean of a 100x100 region at center of chip' / \n", "MEANC200= 'mean of a 200x200 region at center of chip' / \n", "MEANC300= 'mean of a 300x300 region at center of chip' / \n", "BACKGRND= 'estimated background level' / " ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "refheader" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "testheader = fits.getheader(\"../tests/data/outputs/header_outtest.fits\")" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "testheader2 = fits.getheader(\"../tests/data/outputs/header_modify_outtest.fits\")" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[[-1.5442986 , 0.91693103, -0.09551175, ..., 0.61729944,\n", " 0.69078577, -0.26579204],\n", " [-0.8824396 , -1.092421 , 0.9486601 , ..., -0.15046741,\n", " 0.8917887 , -1.2892787 ],\n", " [-2.8122025 , -0.19849575, -0.20965841, ..., 1.784664 ,\n", " 0.8454866 , -0.317576 ],\n", " ...,\n", " [-2.6957903 , -0.3694622 , 1.9655508 , ..., -0.2042407 ,\n", " -0.22842535, -0.3640667 ],\n", " [-1.8624237 , -0.27407092, -0.05868976, ..., -0.6628461 ,\n", " -0.37871024, -0.4661588 ],\n", " [-0.8094051 , 0.89115345, -0.19425163, ..., -1.342756 ,\n", " -0.2216233 , 0.61090004]],\n", "\n", " [[ 0.50445807, -0.17986225, -0.02730826, ..., 0.7757869 ,\n", " -0.34262717, -0.22135872],\n", " [ 0.5196407 , -0.27171996, -0.06173214, ..., -0.29152176,\n", " 0.59813404, -0.25505006],\n", " [ 0.38664252, -0.36898297, 0.92303437, ..., -1.2506361 ,\n", " 0.6241902 , -0.20030949],\n", " ...,\n", " [ 0.4626931 , -0.27773476, -0.32133174, ..., 0.7071581 ,\n", " -0.2964111 , -0.34097004],\n", " [-0.11783576, 0.67153037, -1.2704204 , ..., -0.3537143 ,\n", " 0.54571724, 0.6353086 ],\n", " [ 0.43660802, -0.22240925, 0.70566654, ..., 0.5201152 ,\n", " -0.44417912, 0.4505389 ]],\n", "\n", " [[-1.2575521 , 0.13778745, 0.15541984, ..., 1.1896127 ,\n", " 0.1708309 , -0.95014226],\n", " [-0.28101593, 0.14958459, 0.99914944, ..., -0.8667342 ,\n", " 0.04880416, -0.94923484],\n", " [ 0.61468554, 1.034764 , -0.93813926, ..., 0.07872874,\n", " 0.04595524, 1.2033082 ],\n", " ...,\n", " [ 0.05582213, 1.033838 , -0.21055788, ..., 0.10507455,\n", " 0.8273337 , -0.05200879],\n", " [-0.9321866 , 1.8981732 , -0.8078243 , ..., 0.02490172,\n", " -0.08390635, -1.008785 ],\n", " [ 1.5408809 , 1.1998789 , 0.9322442 , ..., -0.06816494,\n", " -0.0836795 , 0.8604679 ]],\n", "\n", " [[ 1.0941448 , 0.89163256, -0.9286778 , ..., 0.7996856 ,\n", " 0.0838072 , 0.7494533 ],\n", " [ 3.3283825 , -0.09378146, -0.9157695 , ..., -1.2198545 ,\n", " -0.9738356 , 0.7978022 ],\n", " [12.159985 , -1.094557 , 0.76850677, ..., 0.8864995 ,\n", " -0.01274775, -0.20867401],\n", " ...,\n", " [ 5.919399 , -0.16590194, -0.99725324, ..., 1.5478771 ,\n", " 0.94178295, 0.9787332 ],\n", " [ 9.18827 , 0.35521197, -1.0150833 , ..., -0.23552904,\n", " -0.2592315 , 2.346139 ],\n", " [ 8.195578 , -1.2376589 , 0.06281453, ..., -0.45571992,\n", " 0.7588966 , 0.781659 ]]], dtype=float32)" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fits.getdata(\"../tests/data/WFPC2u57.fits\")" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[[-3.0885973 , 1.8338621 , -0.1910235 , ..., 1.2345989 ,\n", " 1.3815715 , -0.5315841 ],\n", " [-1.7648792 , -2.184842 , 1.8973202 , ..., -0.30093482,\n", " 1.7835774 , -2.5785575 ],\n", " [-5.624405 , -0.3969915 , -0.41931683, ..., 3.569328 ,\n", " 1.6909732 , -0.635152 ],\n", " ...,\n", " [-5.3915806 , -0.7389244 , 3.9311016 , ..., -0.4084814 ,\n", " -0.4568507 , -0.7281334 ],\n", " [-3.7248473 , -0.54814184, -0.11737952, ..., -1.3256922 ,\n", " -0.7574205 , -0.9323176 ],\n", " [-1.6188102 , 1.7823069 , -0.38850325, ..., -2.685512 ,\n", " -0.4432466 , 1.2218001 ]],\n", "\n", " [[ 1.0089161 , -0.3597245 , -0.05461651, ..., 1.5515738 ,\n", " -0.68525434, -0.44271743],\n", " [ 1.0392814 , -0.5434399 , -0.12346429, ..., -0.5830435 ,\n", " 1.1962681 , -0.5101001 ],\n", " [ 0.77328503, -0.73796594, 1.8460687 , ..., -2.5012722 ,\n", " 1.2483804 , -0.40061897],\n", " ...,\n", " [ 0.9253862 , -0.5554695 , -0.6426635 , ..., 1.4143162 ,\n", " -0.5928222 , -0.6819401 ],\n", " [-0.23567152, 1.3430607 , -2.5408409 , ..., -0.7074286 ,\n", " 1.0914345 , 1.2706172 ],\n", " [ 0.87321603, -0.4448185 , 1.4113331 , ..., 1.0402304 ,\n", " -0.88835824, 0.9010778 ]],\n", "\n", " [[-2.5151043 , 0.2755749 , 0.31083968, ..., 2.3792255 ,\n", " 0.3416618 , -1.9002845 ],\n", " [-0.56203187, 0.29916918, 1.9982989 , ..., -1.7334684 ,\n", " 0.09760833, -1.8984697 ],\n", " [ 1.2293711 , 2.069528 , -1.8762785 , ..., 0.15745747,\n", " 0.09191048, 2.4066164 ],\n", " ...,\n", " [ 0.11164427, 2.067676 , -0.42111576, ..., 0.21014911,\n", " 1.6546674 , -0.10401759],\n", " [-1.8643732 , 3.7963464 , -1.6156486 , ..., 0.04980344,\n", " -0.1678127 , -2.01757 ],\n", " [ 3.0817618 , 2.3997579 , 1.8644884 , ..., -0.13632989,\n", " -0.167359 , 1.7209358 ]],\n", "\n", " [[ 2.1882896 , 1.7832651 , -1.8573556 , ..., 1.5993712 ,\n", " 0.1676144 , 1.4989066 ],\n", " [ 6.656765 , -0.18756291, -1.831539 , ..., -2.439709 ,\n", " -1.9476712 , 1.5956044 ],\n", " [24.31997 , -2.189114 , 1.5370135 , ..., 1.772999 ,\n", " -0.0254955 , -0.41734803],\n", " ...,\n", " [11.838798 , -0.3318039 , -1.9945065 , ..., 3.0957541 ,\n", " 1.8835659 , 1.9574664 ],\n", " [18.37654 , 0.71042395, -2.0301666 , ..., -0.47105807,\n", " -0.518463 , 4.692278 ],\n", " [16.391155 , -2.4753177 , 0.12562907, ..., -0.91143984,\n", " 1.5177932 , 1.563318 ]]], dtype=float32)" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fits.getdata(\"../tests/data/outputs/imagemodified.fits\", hdu=0)" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "ename": "IndexError", "evalue": "list index out of range", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", "Input \u001b[0;32mIn [37]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mfits\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m../tests/data/outputs/primary_hdu_test.fits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241m.\u001b[39mheader\n", "File \u001b[0;32m~/miniconda3/lib/python3.9/site-packages/astropy/io/fits/hdu/hdulist.py:326\u001b[0m, in \u001b[0;36mHDUList.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 323\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 324\u001b[0m \u001b[38;5;66;03m# Raise a more helpful IndexError if the file was not fully read.\u001b[39;00m\n\u001b[1;32m 325\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_all:\n\u001b[0;32m--> 326\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[1;32m 327\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 328\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mHDU not found, possibly because the index \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 329\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mis out of range, or because the file was \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 330\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mclosed before all HDUs were read\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", "File \u001b[0;32m~/miniconda3/lib/python3.9/site-packages/astropy/io/fits/hdu/hdulist.py:321\u001b[0m, in \u001b[0;36mHDUList.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 317\u001b[0m \u001b[38;5;66;03m# Originally this used recursion, but hypothetically an HDU with\u001b[39;00m\n\u001b[1;32m 318\u001b[0m \u001b[38;5;66;03m# a very large number of HDUs could blow the stack, so use a loop\u001b[39;00m\n\u001b[1;32m 319\u001b[0m \u001b[38;5;66;03m# instead\u001b[39;00m\n\u001b[1;32m 320\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 321\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_try_while_unread_hdus\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__getitem__\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 322\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_positive_index_of\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 323\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 324\u001b[0m \u001b[38;5;66;03m# Raise a more helpful IndexError if the file was not fully read.\u001b[39;00m\n\u001b[1;32m 325\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_all:\n", "File \u001b[0;32m~/miniconda3/lib/python3.9/site-packages/astropy/io/fits/hdu/hdulist.py:1148\u001b[0m, in \u001b[0;36mHDUList._try_while_unread_hdus\u001b[0;34m(self, func, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1146\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 1147\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1148\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1149\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[1;32m 1150\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_next_hdu():\n", "\u001b[0;31mIndexError\u001b[0m: list index out of range" ] } ], "source": [ "fits.open(\"../tests/data/outputs/primary_hdu_test.fits\")[1].header" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "SIMPLE = T / file does conform to FITS standard \n", "BITPIX = -32 / number of bits per data pixel \n", "NAXIS = 2 / number of data axes \n", "NAXIS1 = 300 / length of data axis 1 \n", "NAXIS2 = 300 / length of data axis 2 \n", "COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy\n", "COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H \n", "EQUINOX = 2000.00000000 / Mean equinox \n", "MJD-OBS = 5.837700000000E+04 / Modified Julian date at start \n", "RADESYS = 'ICRS ' / Astrometric system \n", "CTYPE1 = 'RA---TAN' / WCS projection type for this axis \n", "CUNIT1 = 'deg ' / Axis unit \n", "CRVAL1 = 0.000000000000E+00 / World coordinate on this axis \n", "CRPIX1 = 8.065000000000000E+02 / Reference pixel on this axis \n", "CD1_1 = -1.527777777778E-04 / Linear projection matrix \n", "CD1_2 = 0.000000000000E+00 / Linear projection matrix \n", "CTYPE2 = 'DEC--TAN' / WCS projection type for this axis \n", "CUNIT2 = 'deg ' / Axis unit \n", "CRVAL2 = 7.000000000000E-01 / World coordinate on this axis \n", "CRPIX2 = 4.078500000000000E+03 / Reference pixel on this axis \n", "CD2_1 = 0.000000000000E+00 / Linear projection matrix \n", "CD2_2 = 1.527777777778E-04 / Linear projection matrix \n", "EXPTIME = 1.0 / Normalized exposure time \n", "GAIN = 1.146109603156E+02 / Maximum equivalent gain (e-/ADU) \n", "SATURATE= 1.604197510261E+03 / Saturation Level (ADU) \n", "COMMENT \n", "SOFTNAME= 'SWarp ' / The software that processed those data \n", "SOFTVERS= '2.38.0 ' / Version of the software \n", "SOFTDATE= '2017-01-17' / Release date of the software \n", "SOFTAUTH= '2010-2012 IAP/CNRS/UPMC' / Maintainer of the software \n", "SOFTINST= 'IAP http://www.iap.fr' / Institute \n", "COMMENT \n", "AUTHOR = 'jype ' / Who ran the software \n", "ORIGIN = 't80s-jype4' / Where it was done \n", "DATE = '2019-03-02T21:31:43' / When it was started (GMT) \n", "COMBINET= 'WEIGHTED' / COMBINE_TYPE config parameter for SWarp \n", "COMMENT \n", "COMMENT Propagated FITS keywords \n", "OBJECT = 'STRIPE82_0002' / name of observed object \n", "TELESCOP= 'T80 ' / Telescope Model \n", "INSTRUME= 'T80Cam ' / Custom. Name of instrument \n", "FILTER = 'R ' / Filter used for this observation \n", "COMMENT \n", "COMMENT Axis-dependent config parameters \n", "RESAMPT1= 'LANCZOS3' / RESAMPLING_TYPE config parameter \n", "CENTERT1= 'MANUAL ' / CENTER_TYPE config parameter \n", "PSCALET1= 'MANUAL ' / PIXELSCALE_TYPE config parameter \n", "RESAMPT2= 'LANCZOS3' / RESAMPLING_TYPE config parameter \n", "CENTERT2= 'MANUAL ' / CENTER_TYPE config parameter \n", "PSCALET2= 'MANUAL ' / PIXELSCALE_TYPE config parameter \n", " STATS 2019-03-02T18:31:52.086662 \n", "HIERARCH OAJ QC NCMODE = 0.0 / Mode (ADU) \n", "HIERARCH OAJ QC NCMIDPT = 0.0 / Level estim (ADU) \n", "HIERARCH OAJ QC NCMIDRMS = 0.005 / rms level (ADU) \n", "HIERARCH OAJ QC NCNOISE = 0.1508 / Noise estim (ADU) \n", "HIERARCH OAJ QC NCNOIRMS = 0.0107 / rms noise estim (ADU) \n", " FWHM ESTIM 2019-03-02T18:32:23.666912 \n", "HIERARCH OAJ PRO FWHMSEXT = 1.361 / FWHM arcsec estimated with SE \n", "HIERARCH OAJ PRO FWHMSRMS = 0.08 / rms in FWHM with SE \n", "HIERARCH OAJ PRO FWHMMEAN = 1.26561051607132 / PSFex FWHM \n", "HIERARCH OAJ PRO FWHMBETA = 3.503599882125854 / PSFex beta \n", "HIERARCH OAJ PRO FWHMNSTARS = 497 / PSFex nstars \n", "HIERARCH OAJ PRO ELLIPMEAN = 0.0132039999589324 / PSFex Ellip \n", "PIXSCALE= 0.55 \n", "FILENAME= 'STRIPE82-0002_R_swp.fits' \n", "NCOMBINE= 3 \n", "TEXPOSED= 120.0 \n", "EFECTIME= 119.3876463529304 \n", "TEXPSUM = 120.0 / Maximum equivalent exposure time (s) \n", "HIERARCH OAJ PRO PIPVERS = '0.9.9 ' \n", "HIERARCH OAJ PRO REFIMAGE = 'STRIPE82-20180916-045151_proc' / Reference image fo\n", "HIERARCH OAJ PRO REFAIRMASS = 1.168602482650322 / Reference image airmass \n", "HIERARCH OAJ PRO REFDATEOBS = '2018-09-16T04:50:48.878000' / Reference image dat\n", "HIERARCH OAJ PRO SWCMB1 = 'STRIPE82-20180916-045031_proc' \n", "HIERARCH OAJ PRO SWSCALE1 = 0.02499987191347 \n", "HIERARCH OAJ PRO SWCMB2 = 'STRIPE82-20180916-045151_proc' \n", "HIERARCH OAJ PRO SWSCALE2 = 0.0248725668487 \n", "HIERARCH OAJ PRO SWCMB3 = 'STRIPE82-20180916-045310_proc' \n", "HIERARCH OAJ PRO SWSCALE3 = 0.02512930320181 \n", "HISTORY Image was compressed by CFITSIO using scaled integer quantization: \n", "HISTORY q = 4.000000 / quantized level scaling parameter \n", "HISTORY 'SUBTRACTIVE_DITHER_1' / Pixel Quantization Algorithm \n", "CHECKSUM= 'dVMmgSJldSJldSJl' / HDU checksum updated 2019-03-02T21:38:27 \n", "DATASUM = '3975140157' / data unit checksum updated 2019-03-02T21:38:27 \n", "X01TILE = 149.5 / Center position \n", "Y01TILE = 149.5 / Center position \n", "X0TILE = 4845.919 / Center position \n", "Y0TILE = 1573.085 / Center position \n", "EXTEND = T / FITS dataset may contain extensions " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fits.getheader(\"../tests/data/0.1_0.1_300_R_swp_splus.fits.fz\", ext=1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "base", "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.9.12" } }, "nbformat": 4, "nbformat_minor": 2 }