Changeset 11


Ignore:
Timestamp:
06/02/08 15:59:58 (16 years ago)
Author:
meynadie
Message:

Mise au point pre.py

Location:
datared
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • datared/gen_degrade.py

    r9 r11  
    1212(options, args) = parser.parse_args () 
    1313 
    14 if (len(args) !=2) : 
     14if (len(args) !=1) : 
    1515    print "Usage : gen_degrade.py output.fits" 
    1616 
    1717# Génération de la matrice 
    18 a = numpy.zeros((2160,2053)) 
     18a = numpy.zeros((2053,2160)) 
    1919for i in range(2160): 
    20     a[i,:]=i+1 
     20    a[:,i]=i+1 
    2121 
    2222# Creation de l'objet fits 
    23 hdu = pyfits.PrimaryHDU(b) 
     23hdu = pyfits.PrimaryHDU(a) 
    2424hdulist = pyfits.HDUList([hdu]) 
    2525 
    2626prihdr = hdulist[0].header 
    2727prihdr.add_history('Generation de la mire') 
    28 hdulist.writeto(args[1],clobber=True) 
     28hdulist.writeto(args[0],clobber=True) 
    2929 
    3030 
  • datared/pre.py

    r9 r11  
    22# coding: utf-8 
    33 
    4 VERSION='1.1' 
     4VERSION='1.2' 
     5 
     6# Version 1.2 : partie droite débute à 1086 et non 1087 
    57 
    68import pyfits 
     
    810 
    911import numpy 
    10  
     12from scipy import * 
    1113 
    1214parser = OptionParser() 
     15parser.add_option("-n","--nobias",action="store_true", 
     16                  dest="nobias", default=False, 
     17                  help="no suppression of the bias (based on overscans)") 
    1318 
    1419(options, args) = parser.parse_args () 
    1520 
    1621if (len(args) !=2) : 
    17     print "Usage : pre.py input.fits output.fits" 
     22    print "Usage : pre.py [-n --nobias] input.fits output.fits" 
     23    exit(1) 
    1824 
    1925# Ouverture de l'image fits en argument 
     
    2430 
    2531gauche = scidata[:2048,50:1074] 
    26 droite = scidata[:2048,1087:2111] 
     32droite = scidata[:2048,1086:2110] 
    2733 
    28 # Suppression du fond (version brutale) 
    29 print "Warning ! bias removed (1600 / 2090) " 
     34# Suppression du fond selon moyenne des overscans 
    3035 
    31 gauche -= 1600  
    32 droite -= 2090 
     36if options.nobias : 
     37    print "No bias substraction" 
     38else: 
     39    bias_gauche = mean(scidata[:2048,:50])-10 
     40    bias_droite = mean(scidata[:2048,2110:])-10 
     41    print "Warning ! bias removed (%f / %f) " % (bias_gauche, bias_droite) 
     42    gauche -= bias_gauche 
     43    droite -= bias_droite 
    3344 
    3445scidata = numpy.hstack((gauche,droite)) 
     
    3950 
    4051prihdr = hdulist[0].header 
     52prihdr.add_history('pre.py V'+VERSION) 
    4153prihdr.add_history('Suppression os/ps') 
    4254 
Note: See TracChangeset for help on using the changeset viewer.