コード例 #1
0
ファイル: pdiff.py プロジェクト: jmel/NIRES
#!/usr/bin/env python
# Take difference between two fits files

import sys, pyfits as pf
import ds9
import warnings
import imDisplay as imD

if len(sys.argv) == 4: 

    title, prefix = imD.returnInst(sys.argv[1]) 

    a = imD.readImage(imD.nameResolve(sys.argv[2], prefix))
    b = imD.readImage(imD.nameResolve(sys.argv[3], prefix))
else:
    print 'Did not specify required arguments, Here are some examples: "pdiffs 50 51" or "pdiff s 50 51", "pdiffv 50 51" or "pdiff v 50 51"  '
    exit();



def fn(fn):
    return fn.split(".")[0]

try:
    hdu = pf.PrimaryHDU(a - b)
    hdulist = pf.HDUList([hdu])
except:
    print "Could not create FITS HDU"

try:
    fname = "ds9_diff.fits"
コード例 #2
0
ファイル: order_extraction.py プロジェクト: jmel/NIRES
#!/usr/bin/env python
# showing the orders by using the edge detection algorithm


import numpy as np
from astropy.io import fits
import imDisplay as imD
import sys
import globals


fname = imD.nameResolve(sys.argv[1], 's*')
continuum_image = fits.open(fname)
continuum_data = continuum_image[0].data


##own code for order determination

for i in range(1, 1024):
    for j in range(1, 2048):
        if i > 504:
           if j > 1810:
              if continuum_data[i][j] > 25:
                 continuum_data[i][j] = 1
              else:
                 continuum_data[i][j] = 0
           else:
               if continuum_data[i][j] > 45:
                  continuum_data[i][j] = 1
               else:
                  continuum_data[i][j] = 0
コード例 #3
0
ファイル: dp.py プロジェクト: jmel/NIRES
#!/usr/bin/env python
# Take difference between two fits files

import sys
import ds9
import imDisplay as imD
import time

fname = ''
if len(sys.argv) == 3:
    title, prefix = imD.returnInst(sys.argv[1])
    fname = imD.nameResolve(sys.argv[2], prefix)

if fname == '':
    print 'Did not specify required arguments, Here are some examples: "dps 50" or "dp s 50", "dpv 50" or "dp v 50"  '
    exit();
        
try:
    print 'loading ' + fname + ' to ds9'
    dd = 0
    dd = ds9.ds9(title)
    dd.regSave(file=title)
    dd.open(fname, 1) #the number is used to set the frame number in the tile mode which is enable
    dd.regOpen(file=title)
except:
    print "Could not display %s" % fname