source: corel/pre.py @ 2

Last change on this file since 2 was 2, checked in by meynadie, 16 years ago
  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/bin/env python
2# coding: utf-8
3
4VERSION='1.0'
5
6import pyfits
7from optparse import OptionParser
8
9import numpy
10
11
12parser = OptionParser()
13
14(options, args) = parser.parse_args ()
15
16if (len(args) !=2) :
17    print "Usage : pre.py input.fits output.fits"
18
19# Ouverture de l'image fits en argument
20hdulist = pyfits.open(args[0])
21scidata = hdulist[0].data
22
23# suppression prescan/overscan/bord de plage
24
25gauche = scidata[:2048,50:1074]
26droite = scidata[:2048,1087:2111]
27
28scidata = numpy.hstack((gauche,droite))
29dim = scidata.shape
30
31# Remplacement bete des mauvaises colonnes du E0
32# PremiÚre colonne indiquée, largeur 4 colonnes
33
34BadColumns = [92,119,431,715,842,1144,1160,1511]
35for c in BadColumns:
36    scidata[:,c:c+4]=scidata[:,c-5:c-1]
37
38# Suppresion du fond (version brutale)
39
40scidata -= 7000
41scidata = numpy.where(scidata<0,0,scidata)
42
43
44prihdr = hdulist[0].header
45prihdr.add_history('Suppression os/ps')
46prihdr.add_history('Interpolation mauvaises colonnes')
47hdulist[0].data = scidata
48hdulist.writeto(args[1],clobber=True)
49
50
51
52
53hdulist.close()
Note: See TracBrowser for help on using the repository browser.