source: pybcc2fits/pybcc2fits.py @ 10

Last change on this file since 10 was 10, checked in by meynadie, 16 years ago
  • Property svn:executable set to *
File size: 909 bytes
Line 
1#!/bin/env python
2# coding: utf-8
3
4VERSION='0.0'
5
6import pyfits
7from optparse import OptionParser
8
9import numpy
10
11
12parser = OptionParser()
13parser.add_option("-i","--input",dest="InputFilename",
14                  help="Input filename (required)", metavar="RAWIMAGE")
15parser.add_option("-o","--output",dest="OutputFilename",
16                  help="Output Filename (required)", metavar="FITSIMAGE")
17
18
19(options, args) = parser.parse_args ()
20
21
22
23# Ouverture de l'image bcc32
24
25hdulist = pyfits.open(options.InputFilename)
26scidata = hdulist[0].data
27
28
29hdulist[0].data = numpy.cast[numpy.int16](scidata)
30
31# Construction de l'image (flip de la partie droite)
32
33# Creation de l'objet fits
34
35prihdr = hdulist[0].header
36
37prihdr.update('Conv','pybcc2fits','Logiciel de conversion utilise')
38prihdr.update('ConvVer',VERSION,'Version de bcc2fits')
39
40
41of = options.OutputFilename
42
43hdulist.writeto(of,clobber=True)
44
45hdulist.close()
Note: See TracBrowser for help on using the repository browser.